aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/installers.scm
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2019-09-11 15:43:19 -0400
committerCarl Dong <contact@carldong.me>2019-10-11 11:44:44 -0400
commite214a22007450187c3db5d9fdef6ee021be6e953 (patch)
tree5808094fb50825c6f64ca87bfe65da07c85e7e6b /gnu/packages/installers.scm
parent07bec45dd3a1c5fa05f7ebfdb60ddbcf098bd01f (diff)
downloadpatches-e214a22007450187c3db5d9fdef6ee021be6e953.tar
patches-e214a22007450187c3db5d9fdef6ee021be6e953.tar.gz
gnu: Add nsis-x86_64 and nsis-i686.
* guix/build-system/scons.scm (scons-build): Add build-targets and install-targets parameters. * guix/build/scons-build-system.scm (build, install): Adjust accordingly. * doc/guix.texi (Build Systems): Document it. * gnu/packages/installers.scm: New file, (make-nsis): New procedure, (nsis-x86_64, nsis-i686): New variables. * gnu/packages/patches/nsis-env-passthru.patch: New file. * gnu/local.mk (dist_patch_DATA, GNU_SYSTEM_MODULES): Adjust accordingly.
Diffstat (limited to 'gnu/packages/installers.scm')
-rw-r--r--gnu/packages/installers.scm116
1 files changed, 116 insertions, 0 deletions
diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
new file mode 100644
index 0000000000..3a5f08b95a
--- /dev/null
+++ b/gnu/packages/installers.scm
@@ -0,0 +1,116 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Carl Dong <contact@carldong.me>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages installers)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages cross-base)
+ #:use-module (gnu packages python-xyz)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix build-system scons)
+ #:use-module (guix utils))
+
+(define(make-nsis machine target-arch nsis-target-type)
+ (let ((triplet (string-append machine "-" "w64-mingw32")))
+ (package
+ (name (string-append "nsis-" machine))
+ (version "3.04")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://prdownloads.sourceforge.net/nsis/nsis-"
+ version "-src.tar.bz2"))
+ (sha256
+ (base32
+ "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
+ (patches (search-patches "nsis-env-passthru.patch"))))
+ (build-system scons-build-system)
+ (native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet)))
+ ("xbinutils" ,(cross-binutils triplet))
+ ("mingw-w64" ,(cross-libc triplet))))
+ (inputs `(("zlib" ,zlib)))
+ (arguments
+ `(#:scons ,scons-python2
+ #:modules ((srfi srfi-1)
+ (guix build utils)
+ (guix build scons-build-system))
+ #:tests? #f
+ #:scons-flags `("UNICODE=yes"
+ "SKIPUTILS=MakeLangId,Makensisw,NSIS Menu,SubStart,zip2exe"
+ "SKIPDOC=COPYING"
+ "STRIP_CP=no"
+ ,(string-append "PREFIX=" %output)
+ ,(string-append "TARGET_ARCH=" ,target-arch)
+ ,(string-append "XGCC_W32_PREFIX=" ,triplet "-")
+ ,(string-append "PREFIX_PLUGINAPI_INC=" (assoc-ref %build-inputs "mingw-w64") "/include/")
+ ,(string-append "PREFIX_PLUGINAPI_LIB=" (assoc-ref %build-inputs "mingw-w64") "/lib/"))
+ #:build-targets '("makensis"
+ "stubs"
+ "plugins"
+ "utils")
+ #:install-targets '("install-stubs"
+ "install-plugins"
+ "install-data"
+ "install-utils"
+ "install-compiler"
+ "install-conf")
+ #:phases (modify-phases %standard-phases
+ (add-before 'build 'fix-env
+ (lambda _
+ (define* (filter-delimited-string delimited-string predicate #:optional (delimiter #\:))
+ ;; Given a DELIMITED-STRING delimited by DELIMITER,
+ ;; only keep items that satisfy PREDICATE
+ (string-join
+ (filter predicate (string-split delimited-string delimiter))
+ (string delimiter)))
+ (define (mingw-path? path)
+ (string-prefix? (assoc-ref %build-inputs "mingw-w64") path))
+ (for-each
+ (lambda (env-name)
+ (let ((env-val (getenv env-name)))
+ ;; Remove all mingw-w64 paths from env vars meant
+ ;; for native toolchain
+ (setenv env-name
+ (filter-delimited-string env-val (negate mingw-path?)))
+ ;; Add the removed paths back into
+ ;; CROSS_-prefixed version of env vars
+ (setenv (string-append "CROSS_" env-name)
+ (filter-delimited-string env-val mingw-path?))))
+ '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
+ (add-before 'build 'fix-target-detection
+ (lambda _
+ ;; NSIS target detection is screwed up, manually
+ ;; change it ourselves
+ (substitute* "Source/build.cpp" (("m_target_type=TARGET_X86ANSI")
+ (string-append "m_target_type=" ,nsis-target-type))))))))
+ (home-page "http://nsis.sourceforge.net/")
+ (synopsis "A professional open source system to create Windows installers")
+ (description
+ "NSIS (Nullsoft Scriptable Install System) is a professional open
+source system to create Windows installers. It is designed to be as small and
+flexible as possible and is therefore very suitable for internet
+distribution.")
+ (license (license:non-copyleft "file://COPYING"
+ "See COPYING in the distribution.")))))
+
+(define-public nsis-x86_64
+ (make-nsis "x86_64" "amd64" "TARGET_AMD64"))
+
+(define-public nsis-i686
+ (make-nsis "i686" "x86" "TARGET_X86UNICODE"))