| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | (define-module (gnu packages installers)
|
| 21 | #:use-module (gnu packages)
|
| 22 | #:use-module (gnu packages build-tools)
|
| 23 | #:use-module (gnu packages compression)
|
| 24 | #:use-module (gnu packages cross-base)
|
| 25 | #:use-module (guix download)
|
| 26 | #:use-module (guix gexp)
|
| 27 | #:use-module ((guix licenses) #:prefix license:)
|
| 28 | #:use-module (guix packages)
|
| 29 | #:use-module (guix build-system scons)
|
| 30 | #:use-module (guix utils))
|
| 31 |
|
| 32 | (define (make-nsis machine target-arch nsis-target-type)
|
| 33 | (let* ((triplet (string-append machine "-" "w64-mingw32"))
|
| 34 | (xbinutils (cross-binutils triplet))
|
| 35 | (xlibc (cross-libc triplet))
|
| 36 | (xgcc (cross-gcc triplet #:libc xlibc)))
|
| 37 | (package
|
| 38 | (name (string-append "nsis-" machine))
|
| 39 | (version "3.11")
|
| 40 | (source (origin
|
| 41 | (method url-fetch)
|
| 42 | (uri (string-append "http://prdownloads.sourceforge.net/nsis/nsis-"
|
| 43 | version "-src.tar.bz2"))
|
| 44 | (sha256
|
| 45 | (base32
|
| 46 | "0jzz07acshml9fq60v48sgzxp74p1fl2n0yw25ycdgbfcxi21rqr"))
|
| 47 | (patches (search-patches "nsis-env-passthru.patch"))))
|
| 48 | (build-system scons-build-system)
|
| 49 | (native-inputs `(("xgcc" ,xgcc)
|
| 50 | ("xbinutils" ,xbinutils)
|
| 51 | ("mingw-w64" ,xlibc)))
|
| 52 | (inputs (list zlib))
|
| 53 | (arguments
|
| 54 | (list
|
| 55 | #:modules `((srfi srfi-1)
|
| 56 | (srfi srfi-26)
|
| 57 | (guix build utils)
|
| 58 | (guix build scons-build-system))
|
| 59 | #:tests? #f
|
| 60 | #:scons-flags
|
| 61 | #~(list "UNICODE=yes"
|
| 62 | "SKIPUTILS=MakeLangId,Makensisw,NSIS Menu,SubStart,zip2exe"
|
| 63 | "SKIPDOC=COPYING"
|
| 64 | "STRIP_CP=no"
|
| 65 | (string-append "PREFIX=" #$output)
|
| 66 | (string-append "TARGET_ARCH=" #$target-arch)
|
| 67 | (string-append "XGCC_W32_PREFIX=" #$triplet "-")
|
| 68 | (string-append "PREFIX_PLUGINAPI_INC="
|
| 69 | (assoc-ref %build-inputs "mingw-w64")
|
| 70 | "/include/")
|
| 71 | (string-append "PREFIX_PLUGINAPI_LIB="
|
| 72 | (assoc-ref %build-inputs "mingw-w64")
|
| 73 | "/lib/"))
|
| 74 | #:build-targets #~(list "makensis" "stubs" "plugins" "utils")
|
| 75 | #:install-targets
|
| 76 | #~(list "install-stubs"
|
| 77 | "install-plugins"
|
| 78 | "install-data"
|
| 79 | "install-utils"
|
| 80 | "install-compiler"
|
| 81 | "install-conf")
|
| 82 | #:phases
|
| 83 | #~(modify-phases %standard-phases
|
| 84 | (add-before 'build 'fix-env
|
| 85 | (lambda _
|
| 86 | (define* (filter-delimited-string delimited-string predicate
|
| 87 | #:optional (delimiter #\:))
|
| 88 | |
| 89 | |
| 90 | (string-join
|
| 91 | (filter predicate (string-split delimited-string delimiter))
|
| 92 | (string delimiter)))
|
| 93 | (define (mingw-path? path)
|
| 94 | (string-prefix? (assoc-ref %build-inputs "mingw-w64") path))
|
| 95 | (define (xgcc-path? path)
|
| 96 | (string-prefix? (assoc-ref %build-inputs "xgcc") path))
|
| 97 | (define (cross-toolchain-path? path)
|
| 98 | (or (xgcc-path? path) (mingw-path? path)))
|
| 99 |
|
| 100 | (for-each
|
| 101 | (lambda (env-name)
|
| 102 | (let ((env-val (getenv env-name)))
|
| 103 | |
| 104 | |
| 105 | (setenv env-name
|
| 106 | (filter-delimited-string
|
| 107 | env-val (negate cross-toolchain-path?)))
|
| 108 | |
| 109 | |
| 110 | (setenv (string-append "CROSS_" env-name)
|
| 111 | (filter-delimited-string
|
| 112 | env-val cross-toolchain-path?))))
|
| 113 | '("C_INCLUDE_PATH"
|
| 114 | "CPLUS_INCLUDE_PATH"
|
| 115 | "LIBRARY_PATH"))))
|
| 116 | (add-before 'build 'fix-target-detection
|
| 117 | (lambda _
|
| 118 | |
| 119 | |
| 120 | (substitute* "Source/build.cpp"
|
| 121 | (("m_target_type=TARGET_X86UNICODE")
|
| 122 | (string-append "m_target_type=" #$nsis-target-type))))))))
|
| 123 | (home-page "https://nsis.sourceforge.io/Main_Page")
|
| 124 | (synopsis "System to create Windows installers")
|
| 125 | (description
|
| 126 | "NSIS (Nullsoft Scriptable Install System) is a system to create
|
| 127 | Windows installers. It is designed to be as small and flexible as possible
|
| 128 | and is therefore very suitable for internet distribution.")
|
| 129 | (license (license:non-copyleft "file://COPYING"
|
| 130 | "See COPYING in the distribution.")))))
|
| 131 |
|
| 132 | (define-public nsis-x86_64
|
| 133 | (make-nsis "x86_64" "amd64" "TARGET_AMD64"))
|
| 134 |
|
| 135 | (define-public nsis-i686
|
| 136 | (make-nsis "i686" "x86" "TARGET_X86UNICODE"))
|