Loading build.lisp +16 −76 Original line number Diff line number Diff line Loading @@ -4,18 +4,7 @@ (defpackage #:clpm-build (:use #:cl) (:import-from #:uiop #:*stderr* #:*stdout* #:directory-exists-p #:ensure-directory-pathname #:find-symbol* #:getenv #:native-namestring #:pathname-directory-pathname #:run-program #:with-current-directory #:with-safe-io-syntax) (:import-from #:uiop) (:export #:build)) (in-package #:clpm-build) Loading @@ -23,7 +12,7 @@ (defvar *setup-file-pathname* *load-truename* "The pathname to this file.") (defvar *root-pathname* (pathname-directory-pathname *setup-file-pathname*) (defvar *root-pathname* (uiop:pathname-directory-pathname *setup-file-pathname*) "The pathname to the root directory of the CLPM release being built.") (defvar *build-root-pathname* (merge-pathnames "build/" Loading @@ -31,72 +20,23 @@ "The pathname to the root of the build directory. Defaults to build/ inside *ROOT-PATHNAME*") (defun env-var-name (s) (let ((pos (position #\= s))) (subseq s 0 pos))) (defun run-program-augment-env-args (new-env-alist) "Given an alist of environment variables, return a list of arguments suitable for ~uiop:{launch/run}-program~ to set the augmented environment for the child process." (let* ((inherited-env (remove-if (lambda (x) (let ((name (env-var-name x))) (member name new-env-alist :test #'equal :key #'car))) (sb-ext:posix-environ))) (env (append (mapcar (lambda (c) (concatenate 'string (car c) "=" (cdr c))) new-env-alist) inherited-env))) (list :environment env))) (defun run-commands-in-child-lisp (args &key env) (flet ((vomit (stream) (with-safe-io-syntax () (loop :with out := (make-broadcast-stream stream *stdout*) :for arg :in args :do (print arg out))))) (apply #'run-program (list "sbcl" "--script" (uiop:native-namestring (merge-pathnames "scripts/clpm-live" *root-pathname*))) :output :interactive :error-output :interactive :input #'vomit (run-program-augment-env-args (list* '("CLPM_LIVE_PRIVATE_REPL" . "true") env))))) (defun build-clpm () (let ((clpm-pathname #-:os-windows (merge-pathnames "bin/clpm" *build-root-pathname*) #+:os-windows (merge-pathnames "bin/clpm.exe" *build-root-pathname*)) (cache-pathname (merge-pathnames "cl-cache/" *build-root-pathname*))) (format *stderr* "Building `clpm` executable at ~A~%" clpm-pathname) (run-commands-in-child-lisp `((defmethod asdf:output-files ((,(gensym) asdf:program-op) (,(gensym) (eql (asdf:find-system :clpm)))) (values (list ,clpm-pathname) t)) (when (probe-file ,clpm-pathname) (delete-file ,clpm-pathname)) (defmethod asdf:perform ((cl-user::o asdf:image-op) (cl-user::c asdf:system)) (uiop:dump-image (asdf:output-file cl-user::o cl-user::c) :executable (typep cl-user::o 'asdf:program-op) #+:sb-core-compression ,@(list :compression t))) (asdf:operate 'asdf:program-op :clpm)) :env `(("ASDF_OUTPUT_TRANSLATIONS" . ,(format nil "(:output-translations :ignore-inherited-configuration (:root (\"~A\" :implementation :**/ :*.*.*)))" (namestring cache-pathname))))))) (defun build (&key (root-pathname *root-pathname*) (build-root-pathname *build-root-pathname*)) (let ((*root-pathname* (ensure-directory-pathname root-pathname)) (*build-root-pathname* (ensure-directory-pathname build-root-pathname))) (format *stderr* (let* ((*root-pathname* (uiop:ensure-directory-pathname root-pathname)) (*build-root-pathname* (uiop:ensure-directory-pathname build-root-pathname)) (build-cache (merge-pathnames "cl-cache/" *build-root-pathname*))) (format uiop:*stderr* "I will build CLPM from sources located at ~A~%The build files will be located at ~A~%~%~%" *root-pathname* *build-root-pathname*) (build-clpm))) (asdf:clear-configuration) (asdf:initialize-source-registry `(:source-registry :ignore-inherited-configuration (:tree ,*root-pathname*))) (asdf:initialize-output-translations `(:output-translations :ignore-inherited-configuration (:root (,build-cache :implementation :**/ :*.*.*)))) (asdf:make :clpm))) (build) clpm-exec.asd 0 → 100644 +62 −0 Original line number Diff line number Diff line ;;;; CLPM Executable System Definitions ;;;; ;;;; This software is part of CLPM. See README.org for more information. See ;;;; LICENSE for license information. #-:asdf3.1 (error "Requires ASDF >=3.1") ;; Not necessary, but easier to have when using SLIME. (in-package :asdf-user) (defsystem #:clpm-exec :license "BSD-2-Clause") (defsystem #:clpm-exec/dynamic-libs :license "BSD-2-Clause" :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :static-program-op :depends-on (#:clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm-exec/dynamic-libs")))) (values (list (merge-pathnames "build/bin/dynamic/clpm" (pathname-directory-pathname (system-source-file "clpm-exec/dynamic-libs")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm-exec/dynamic-libs")))) "Turn on compression for clpm images." (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t)) (defsystem #:clpm-exec/static-libs :license "BSD-2-Clause" :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :static-program-op :depends-on (#:clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm-exec/static-libs")))) (values (list (merge-pathnames "build/bin/static/clpm" (pathname-directory-pathname (system-source-file "clpm-exec/static-libs")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm-exec/static-libs")))) "Turn on compression for clpm images." ;; TODO: Actually implement a search for the right directory... This should ;; work on most GNU/Linux systems for now. (uiop:register-image-restore-hook (lambda () (setf (uiop:getenv "SSL_CERT_DIR") "/etc/ssl/certs")) nil) (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t)) (defmethod perform ((o cffi-toolchain:static-runtime-op) (s (eql (find-system "clpm-exec/static-libs")))) (cffi-toolchain:link-lisp-executable (output-file o s) (loop :for lib :in (list (first (input-files o s)) "-l:libcrypto.a" "-l:libssl.a") :appending (cffi-toolchain::link-all-library lib)))) (defmethod cffi-toolchain:static-image-new-features (o (s (eql (find-system "clpm-exec/static-libs")))) (list :cl+ssl-foreign-libs-already-loaded)) clpm.asd +18 −0 Original line number Diff line number Diff line Loading @@ -6,11 +6,29 @@ #-:asdf3.1 (error "Requires ASDF >=3.1") ;; Not necessary, but easier to have when using SLIME. (in-package :asdf-user) (defsystem #:clpm :version (:read-file-form "src/clpm/version.lisp" :at (2 2)) :description "A Common Lisp package Manager" :license "BSD-2-Clause" :pathname "src/clpm/" :class :package-inferred-system :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :load-op :in-order-to ((build-op (build-op :clpm-exec/dynamic-libs) (build-op :clpm-exec/static-libs))) :depends-on (#:clpm/clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm")))) (values (list (merge-pathnames "build/bin/clpm" (pathname-directory-pathname (system-source-file "clpm")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm")))) "Turn on compression for clpm images." (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t)) cffi @ a84950e4 Compare 78143fd6 to a84950e4 Original line number Diff line number Diff line Subproject commit 78143fd68d4f544587ad20ae97eaa38e327d0ceb Subproject commit a84950e4246b88681a4fd3f5154e01bff900bf6b src/clpm/http-client/all.lisp +3 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,9 @@ (uiop:define-package #:clpm/http-client/all (:use #:cl #:clpm/http-client/curl #:clpm/http-client/defs) ;;#:clpm/http-client/curl #:clpm/http-client/defs #:clpm/http-client/drakma) (:reexport #:clpm/http-client/defs)) (in-package #:clpm/http-client/all) Loading
build.lisp +16 −76 Original line number Diff line number Diff line Loading @@ -4,18 +4,7 @@ (defpackage #:clpm-build (:use #:cl) (:import-from #:uiop #:*stderr* #:*stdout* #:directory-exists-p #:ensure-directory-pathname #:find-symbol* #:getenv #:native-namestring #:pathname-directory-pathname #:run-program #:with-current-directory #:with-safe-io-syntax) (:import-from #:uiop) (:export #:build)) (in-package #:clpm-build) Loading @@ -23,7 +12,7 @@ (defvar *setup-file-pathname* *load-truename* "The pathname to this file.") (defvar *root-pathname* (pathname-directory-pathname *setup-file-pathname*) (defvar *root-pathname* (uiop:pathname-directory-pathname *setup-file-pathname*) "The pathname to the root directory of the CLPM release being built.") (defvar *build-root-pathname* (merge-pathnames "build/" Loading @@ -31,72 +20,23 @@ "The pathname to the root of the build directory. Defaults to build/ inside *ROOT-PATHNAME*") (defun env-var-name (s) (let ((pos (position #\= s))) (subseq s 0 pos))) (defun run-program-augment-env-args (new-env-alist) "Given an alist of environment variables, return a list of arguments suitable for ~uiop:{launch/run}-program~ to set the augmented environment for the child process." (let* ((inherited-env (remove-if (lambda (x) (let ((name (env-var-name x))) (member name new-env-alist :test #'equal :key #'car))) (sb-ext:posix-environ))) (env (append (mapcar (lambda (c) (concatenate 'string (car c) "=" (cdr c))) new-env-alist) inherited-env))) (list :environment env))) (defun run-commands-in-child-lisp (args &key env) (flet ((vomit (stream) (with-safe-io-syntax () (loop :with out := (make-broadcast-stream stream *stdout*) :for arg :in args :do (print arg out))))) (apply #'run-program (list "sbcl" "--script" (uiop:native-namestring (merge-pathnames "scripts/clpm-live" *root-pathname*))) :output :interactive :error-output :interactive :input #'vomit (run-program-augment-env-args (list* '("CLPM_LIVE_PRIVATE_REPL" . "true") env))))) (defun build-clpm () (let ((clpm-pathname #-:os-windows (merge-pathnames "bin/clpm" *build-root-pathname*) #+:os-windows (merge-pathnames "bin/clpm.exe" *build-root-pathname*)) (cache-pathname (merge-pathnames "cl-cache/" *build-root-pathname*))) (format *stderr* "Building `clpm` executable at ~A~%" clpm-pathname) (run-commands-in-child-lisp `((defmethod asdf:output-files ((,(gensym) asdf:program-op) (,(gensym) (eql (asdf:find-system :clpm)))) (values (list ,clpm-pathname) t)) (when (probe-file ,clpm-pathname) (delete-file ,clpm-pathname)) (defmethod asdf:perform ((cl-user::o asdf:image-op) (cl-user::c asdf:system)) (uiop:dump-image (asdf:output-file cl-user::o cl-user::c) :executable (typep cl-user::o 'asdf:program-op) #+:sb-core-compression ,@(list :compression t))) (asdf:operate 'asdf:program-op :clpm)) :env `(("ASDF_OUTPUT_TRANSLATIONS" . ,(format nil "(:output-translations :ignore-inherited-configuration (:root (\"~A\" :implementation :**/ :*.*.*)))" (namestring cache-pathname))))))) (defun build (&key (root-pathname *root-pathname*) (build-root-pathname *build-root-pathname*)) (let ((*root-pathname* (ensure-directory-pathname root-pathname)) (*build-root-pathname* (ensure-directory-pathname build-root-pathname))) (format *stderr* (let* ((*root-pathname* (uiop:ensure-directory-pathname root-pathname)) (*build-root-pathname* (uiop:ensure-directory-pathname build-root-pathname)) (build-cache (merge-pathnames "cl-cache/" *build-root-pathname*))) (format uiop:*stderr* "I will build CLPM from sources located at ~A~%The build files will be located at ~A~%~%~%" *root-pathname* *build-root-pathname*) (build-clpm))) (asdf:clear-configuration) (asdf:initialize-source-registry `(:source-registry :ignore-inherited-configuration (:tree ,*root-pathname*))) (asdf:initialize-output-translations `(:output-translations :ignore-inherited-configuration (:root (,build-cache :implementation :**/ :*.*.*)))) (asdf:make :clpm))) (build)
clpm-exec.asd 0 → 100644 +62 −0 Original line number Diff line number Diff line ;;;; CLPM Executable System Definitions ;;;; ;;;; This software is part of CLPM. See README.org for more information. See ;;;; LICENSE for license information. #-:asdf3.1 (error "Requires ASDF >=3.1") ;; Not necessary, but easier to have when using SLIME. (in-package :asdf-user) (defsystem #:clpm-exec :license "BSD-2-Clause") (defsystem #:clpm-exec/dynamic-libs :license "BSD-2-Clause" :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :static-program-op :depends-on (#:clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm-exec/dynamic-libs")))) (values (list (merge-pathnames "build/bin/dynamic/clpm" (pathname-directory-pathname (system-source-file "clpm-exec/dynamic-libs")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm-exec/dynamic-libs")))) "Turn on compression for clpm images." (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t)) (defsystem #:clpm-exec/static-libs :license "BSD-2-Clause" :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :static-program-op :depends-on (#:clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm-exec/static-libs")))) (values (list (merge-pathnames "build/bin/static/clpm" (pathname-directory-pathname (system-source-file "clpm-exec/static-libs")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm-exec/static-libs")))) "Turn on compression for clpm images." ;; TODO: Actually implement a search for the right directory... This should ;; work on most GNU/Linux systems for now. (uiop:register-image-restore-hook (lambda () (setf (uiop:getenv "SSL_CERT_DIR") "/etc/ssl/certs")) nil) (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t)) (defmethod perform ((o cffi-toolchain:static-runtime-op) (s (eql (find-system "clpm-exec/static-libs")))) (cffi-toolchain:link-lisp-executable (output-file o s) (loop :for lib :in (list (first (input-files o s)) "-l:libcrypto.a" "-l:libssl.a") :appending (cffi-toolchain::link-all-library lib)))) (defmethod cffi-toolchain:static-image-new-features (o (s (eql (find-system "clpm-exec/static-libs")))) (list :cl+ssl-foreign-libs-already-loaded))
clpm.asd +18 −0 Original line number Diff line number Diff line Loading @@ -6,11 +6,29 @@ #-:asdf3.1 (error "Requires ASDF >=3.1") ;; Not necessary, but easier to have when using SLIME. (in-package :asdf-user) (defsystem #:clpm :version (:read-file-form "src/clpm/version.lisp" :at (2 2)) :description "A Common Lisp package Manager" :license "BSD-2-Clause" :pathname "src/clpm/" :class :package-inferred-system :defsystem-depends-on (#:cffi-toolchain) :entry-point "clpm/cli/entry:main" :build-operation :load-op :in-order-to ((build-op (build-op :clpm-exec/dynamic-libs) (build-op :clpm-exec/static-libs))) :depends-on (#:clpm/clpm)) (defmethod output-files ((o cffi-toolchain:static-program-op) (c (eql (find-system "clpm")))) (values (list (merge-pathnames "build/bin/clpm" (pathname-directory-pathname (system-source-file "clpm")))) t)) (defmethod perform ((o image-op) (c (eql (find-system "clpm")))) "Turn on compression for clpm images." (dump-image (output-file o c) :executable (typep o 'program-op) #+:sb-core-compression :compression #+:sb-core-compression t))
cffi @ a84950e4 Compare 78143fd6 to a84950e4 Original line number Diff line number Diff line Subproject commit 78143fd68d4f544587ad20ae97eaa38e327d0ceb Subproject commit a84950e4246b88681a4fd3f5154e01bff900bf6b
src/clpm/http-client/all.lisp +3 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,9 @@ (uiop:define-package #:clpm/http-client/all (:use #:cl #:clpm/http-client/curl #:clpm/http-client/defs) ;;#:clpm/http-client/curl #:clpm/http-client/defs #:clpm/http-client/drakma) (:reexport #:clpm/http-client/defs)) (in-package #:clpm/http-client/all)