diff options
Diffstat (limited to 'nonguix/build')
-rw-r--r-- | nonguix/build/binary-build-system.scm | 51 | ||||
-rw-r--r-- | nonguix/build/chromium-binary-build-system.scm | 74 | ||||
-rw-r--r-- | nonguix/build/utils.scm | 22 |
3 files changed, 112 insertions, 35 deletions
diff --git a/nonguix/build/binary-build-system.scm b/nonguix/build/binary-build-system.scm index 913ff44..e5bbc48 100644 --- a/nonguix/build/binary-build-system.scm +++ b/nonguix/build/binary-build-system.scm @@ -1,21 +1,7 @@ -;;; GNU Guix --- Functional package management for GNU +;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name> -;;; -;;; This file is not 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/>. +;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> (define-module (nonguix build binary-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) @@ -148,10 +134,39 @@ The inputs are optional when the file is an executable." patchelf-plan))) #t) +(define (deb-file? binary-file) + (string-suffix? ".deb" binary-file)) + +(define (unpack-deb deb-file) + (invoke "ar" "x" deb-file) + (invoke "tar" "xvf" "data.tar.xz") + (invoke "rm" "-rfv" "control.tar.gz" + "data.tar.xz" + deb-file + "debian-binary")) + +(define* (binary-unpack #:key source #:allow-other-keys) + (let* ((files (filter (lambda (f) + (not (string=? (basename f) "environment-variables"))) + (find-files (getcwd)))) + (binary-file (car files))) + (when (= 1 (length files)) + (mkdir "binary") + (chdir "binary") + (match binary-file + ((? deb-file?) (unpack-deb binary-file)) + (_ + (begin + (format #t "Unknown file type: ~a~%" (basename binary-file)) + ;; Cleanup after ourselves + (chdir "..") + (rmdir "binary"))))))) + (define %standard-phases - ;; Everything is as with the GNU Build System except for the `configure' - ;; , `build', `check' and `install' phases. + ;; Everything is as with the GNU Build System except for the `binary-unpack', + ;; `configure', `build', `check' and `install' phases. (modify-phases gnu:%standard-phases + (add-after 'unpack 'binary-unpack binary-unpack) (delete 'bootstrap) (delete 'configure) (delete 'build) diff --git a/nonguix/build/chromium-binary-build-system.scm b/nonguix/build/chromium-binary-build-system.scm new file mode 100644 index 0000000..8429742 --- /dev/null +++ b/nonguix/build/chromium-binary-build-system.scm @@ -0,0 +1,74 @@ +;;; SPDX-License-Identifier: GPL-3.0-or-later +;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> + +(define-module (nonguix build chromium-binary-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module ((nonguix build binary-build-system) #:prefix binary:) + #:use-module (guix build utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:export (%standard-phases + chromium-binary-build)) + +;; Commentary: +;; +;; Builder-side code of the Chromium binary build procedure. +;; +;; Code: + +(define* (install-wrapper #:key inputs outputs #:allow-other-keys) + (let* ((output (assoc-ref outputs "out")) + (bin (string-append output "/bin")) + (fontconfig-minimal (assoc-ref inputs "fontconfig")) + (nss (assoc-ref inputs "nss")) + (wrap-inputs (map cdr inputs)) + (lib-directories + (search-path-as-list '("lib") wrap-inputs)) + (bin-directories + (search-path-as-list + '("bin" "sbin" "libexec") + wrap-inputs))) + (for-each + (lambda (exe) + (display (string-append "Wrapping " exe "\n")) + (wrap-program exe + `("FONTCONFIG_PATH" ":" prefix + (,(string-join + (list + (string-append fontconfig-minimal "/etc/fonts") + output) + ":"))) + `("PATH" ":" prefix + (,(string-join + (append + bin-directories + (list + bin)) + ":"))) + `("LD_LIBRARY_PATH" ":" prefix + (,(string-join + (append + lib-directories + (list + (string-append nss "/lib/nss") + output)) + ":"))))) + (map + (lambda (exe) (string-append bin "/" exe)) + (filter + (lambda (exe) (not (string-prefix? "." exe))) + (scandir bin)))) + #t)) + +(define %standard-phases + ;; Everything is as with the binary-build-system except for the + ;; `install-wrapper' phase. + (modify-phases binary:%standard-phases + (add-after 'install 'install-wrapper install-wrapper))) + +(define* (chromium-binary-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given package, applying all of PHASES in order." + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) + +;;; chromium-binary-build-system.scm ends here diff --git a/nonguix/build/utils.scm b/nonguix/build/utils.scm index ab437f2..4de2ac2 100644 --- a/nonguix/build/utils.scm +++ b/nonguix/build/utils.scm @@ -1,30 +1,18 @@ -;;; GNU Guix --- Functional package management for GNU +;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz> ;;; Copyright © 2020 Alex Griffin <a@ajgrf.com> -;;; -;;; This file is not 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/>. +;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> (define-module (nonguix build utils) #:use-module (ice-9 match) #:use-module (ice-9 binary-ports) #:use-module (guix build utils) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (64-bit? make-wrapper - concatenate-files)) + concatenate-files + build-paths-from-inputs)) (define (64-bit? file) "Return true if ELF file is in 64-bit format, false otherwise. |