aboutsummaryrefslogtreecommitdiff
;;; 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 build-tools)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cross-base)
  #: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"))
         (xbinutils (cross-binutils triplet))
         (xlibc (cross-libc triplet))
         (xgcc (cross-gcc triplet #:libc xlibc)))
    (package
      (name (string-append "nsis-" machine))
      (version "3.10")
      (source (origin
                (method url-fetch)
                (uri (string-append "http://prdownloads.sourceforge.net/nsis/nsis-"
                                    version "-src.tar.bz2"))
                (sha256
                 (base32
                  "15xj1izz3cmaw0mazsvfm8jpr132dyphlw5j0pszwimb0xilmd8i"))
                (patches (search-patches "nsis-env-passthru.patch"))))
      (build-system scons-build-system)
      (native-inputs `(("xgcc" ,xgcc)
                       ("xbinutils" ,xbinutils)
                       ("mingw-w64" ,xlibc)))
      (inputs (list zlib))
      (arguments
       `(#:scons ,scons-3
         #:modules ((srfi srfi-1)
                    (srfi srfi-26)
                    (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?))))
                         '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
                        ;; Hack to place mingw-w64 path at the end of search
                        ;; paths.  Could probably use a specfile and dirafter
                        (setenv "CROSS_C_INCLUDE_PATH"
                                (string-join
                                 `(,@(map (cut string-append
                                               (assoc-ref %build-inputs "xgcc")
                                               "/lib/gcc/" ,triplet "/"
                                               ,(package-version xgcc) <>)
                                          '("/include"
                                            "/include-fixed"))
                                   ,(getenv "CROSS_C_INCLUDE_PATH"))
                                 ":"))
                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
                                (string-join
                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
                                          `("/include/c++"
                                            ,(string-append "/include/c++/" ,triplet)
                                            "/include/c++/backward"
                                            ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
                                                   '("/include"
                                                     "/include-fixed"))))
                                   ,(getenv "CROSS_CPLUS_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_X86UNICODE")
                                                         (string-append "m_target_type=" ,nsis-target-type))))))))
      (home-page "https://nsis.sourceforge.io/Main_Page")
      (synopsis "System to create Windows installers")
      (description
       "NSIS (Nullsoft Scriptable Install System) is a 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"))
cm: Remove some unecessary module imports. Efraim Flashner 2023-02-12gnu: WebKit: Update to 2.38.4....* gnu/packages/webkit.scm (%webkit-version, webkitgtk, wpewebkit): Update to 2.38.4. Leo Famulari 2023-01-30Merge remote-tracking branch 'origin/master' into core-updates... Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm Efraim Flashner 2023-01-29gnu: Unify webkitgtk and webkitgtk-next....* gnu/packages/webkit.scm (%webkit-version): Update to 2.38.3. (webkitgtk)[source]: Update hash. [arguments]<#:phases>: Add ‘set-CC’. Remove ‘patch-gtk-doc-scan’. [native-inputs]: Remove gtk-doc/stable and docbook-xml. Add gi-docgen. (webkitgtk-next)[name]: Rename to ‘webkitgtk-next’. [source, native-inputs]: Inherit fully. [arguments]<#:phases>: Inherit fully. (wpewebkit)[source]: Update hash. Liliana Marie Prikler 2023-01-08gnu: webkitgtk-next: Update to 2.38.3....* gnu/packages/webkit.scm (webkitgtk-next): Update to 2.38.3. Efraim Flashner 2022-11-09gnu: webkitgtk-next: Update to 2.38.2....* gnu/packages/webkit.scm (webkitgtk-next): Update to 2.38.2. Efraim Flashner 2022-11-09gnu: webkitgtk: Update to 2.36.8....* gnu/packages/webkit.scm (%webkit-version, webkitgtk, wpewebkit): Update to 2.36.8. Efraim Flashner 2022-10-12Merge remote-tracking branch 'origin/master' into staging...Conflicts: gnu/packages/gnuzilla.scm gnu/packages/graphics.scm gnu/packages/gstreamer.scm gnu/packages/gtk.scm gnu/packages/kde-frameworks.scm gnu/packages/video.scm Efraim Flashner 2022-10-01gnu: webkitgtk: Update to 2.38.0....* gnu/packages/webkit.scm (webkitgtk): Update to 2.38.0. Liliana Marie Prikler 2022-09-15Merge branch 'staging' into core-updates...Conflicts resolved in: gnu/local.mk gnu/packages/cmake.scm gnu/packages/glib.scm gnu/packages/gnome.scm gnu/packages/gtk.scm gnu/packages/sdl.scm pango-next, vala-next and librsvg-bootstrap were removed in the process. Maxim Cournoyer 2022-09-15Merge branch 'master' into staging...With resolved conflicts in: gnu/local.mk gnu/packages/freedesktop.scm gnu/packages/gnuzilla.scm Maxim Cournoyer 2022-09-13gnu: Add webkitgtk-next....* gnu/packages/webkit.scm (webkitgtk-next): New variable. Maxim Cournoyer 2022-09-13gnu: gnome-online-accounts: Update to 3.45.2, remove "lib" output....* gnu/packages/gnome.scm (gnome-online-accounts): Update to 3.45.2. [build-system]: Use meson-build-system. [glib-or-gtk?]: New argument. [phases]{patch-libgoa-output}: Delete phase. {disable-gtk-update-icon-cache}: New phase. [native-inputs]: Add gettext-minimal. [inputs]: Replace rest with rest-next; replace webkitgtk-with-libsoup2 with webkitgtk. Add gcr and mit-krb5. (gnome-recipes): Adjust for the removed gnome-online-accounts output. (gnome-music, gnome-online-miners, gnome-initial-setup): Likewise. (libgdata, gnome-contacts, grilo-plugins, evolution-data-server) (gnome-shell, gnome-todo, gnome-calendar, gnome-shell-extensions) (gnome-calculator, gnome-latex): Likewise. (gnome-online-accounts-3.44): New variable. * gnu/packages/geo.scm (gnome-maps): Likewise. * gnu/packages/webkit.scm: Update comment. Maxim Cournoyer 2022-09-07Merge branch 'master' into stagingMarius Bakke 2022-09-04gnu: webkitgtk: Increase the CI time-out period....* gnu/packages/webkit.scm (webkitgtk)[properties]: Increase the TIMEOUT to 40 hours. Tobias Geerinckx-Rice 2022-08-28Merge branch 'master' into stagingMarius Bakke 2022-08-28gnu: webkit: Update to 2.36.7....* gnu/packages/webkit.scm (%webkit-version, webkitgtk, wpewebkit): Update to 2.36.7. Efraim Flashner 2022-07-28gnu: webkitgtk: Add missing inputs....* gnu/packages/webkit.scm (webkitgtk)[inputs]: Add gst-plugins-bad-minimal and libgudev. Liliana Marie Prikler