Commit d9731b07 authored by Eric Timmons's avatar Eric Timmons
Browse files

Removing some dead files

parent 01697ef4
;;;; CLPM ASDF Extensions System Definition
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
#-:asdf3.2
(error "Requires ASDF >=3.2")
(defsystem #:clpm-asdf
:version "0.0.1"
:description "ASDF Extensions for CLPM"
:license "BSD-2-Clause"
:pathname "src/clpm-asdf/"
:class :package-inferred-system
:depends-on (#:clpm-asdf/clpm-asdf))
;;;; CLPM Executable System Definitions
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
#-:asdf3.2
(error "Requires ASDF >=3.2")
;; 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
:build-pathname "build/bin/dynamic/clpm"
:depends-on (#:clpm))
(defmethod asdf:operation-done-p ((o image-op) (c (eql (find-system "clpm-exec/dynamic-libs"))))
nil)
(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))
(defmethod cffi-toolchain:static-image-new-features
(o (s (eql (find-system "clpm-exec/dynamic-libs"))))
"Prevent cl-ssl from loading the foreign libraries at build time."
`(:cl+ssl-foreign-libs-already-loaded
,@(when (uiop:os-windows-p)
`(:drakma-no-ssl))))
(defmethod cffi-toolchain:static-image-remove-features-on-dump
(o (s (eql (find-system "clpm-exec/dynamic-libs"))))
"The libraries are not truly loaded, we just tricked cl+ssl, so remove that
feature on dump."
(list :cl+ssl-foreign-libs-already-loaded))
(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
:build-pathname "build/bin/static/clpm"
:depends-on (#:clpm))
(defmethod operation-done-p ((o image-op) (c (eql (find-system "clpm-exec/static-libs"))))
nil)
(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 `(,(first (input-files o s))
,@(unless (uiop:os-windows-p)
'("-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"))))
`(:cl+ssl-foreign-libs-already-loaded
,@(when (uiop:os-windows-p)
'(:drakma-no-ssl))))
;;;; When loaded, this builds a dynamically linked CLPM.
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(in-package #:cl-user)
(load (merge-pathnames "common.lisp"
*load-truename*))
(in-package #:clpm-scripts)
(setup-asdf "dynamic")
(format uiop:*stderr*
"I will build CLPM from sources located at ~A~%The built files will be located at ~Abin/~%~%~%"
*root-pathname*
*build-root-pathname*)
;; Special handling for Windows builds.
(when (uiop:os-windows-p)
;; CL-PLUS-SSL requires sb-bsd-socket be loaded (it uses an internal package
;; loaded by that contrib), but it doesn't declare a dependency on it.
;; (require :sb-bsd-sockets)
;; By default, openssl is ~useless on Windows. Don't build it until we can
;; figure out how to make it use the OS' certificate store.
(pushnew :drakma-no-ssl *features*))
(asdf:make :clpm-exec/dynamic-libs)
;;;; When loaded, this builds a statically linked CLPM.
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(in-package #:cl-user)
(load (merge-pathnames "common.lisp"
*load-truename*))
(in-package #:clpm-scripts)
(setup-asdf "static")
(format uiop:*stderr*
"I will build CLPM from sources located at ~A~%The built files will be located at ~Abin/~%~%~%"
*root-pathname*
*build-root-pathname*)
;; Special handling for Windows builds.
(when (uiop:os-windows-p)
;; CL-PLUS-SSL requires sb-bsd-socket be loaded (it uses an internal package
;; loaded by that contrib), but it doesn't declare a dependency on it.
;; (require :sb-bsd-sockets)
;; By default, openssl is ~useless on Windows. Don't build it until we can
;; figure out how to make it use the OS' certificate store.
(pushnew :drakma-no-ssl *features*))
(asdf:make :clpm-exec/static-libs)
#!/bin/sh
":" ; exec sbcl --script "$0" "$@" # -*- mode: common-lisp; -*-
;;;; Script to build CLPM with dynamic libraries
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(in-package :cl-user)
(load (merge-pathnames "build-dynamic.lisp" *load-truename*))
#!/bin/sh
":" ; exec sbcl --script "$0" "$@" # -*- mode: common-lisp; -*-
;;;; Script to build CLPM with static libraries
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(in-package :cl-user)
(load (merge-pathnames "build-static.lisp" *load-truename*))
;;;; ASDF extensions for CLPM
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-asdf/clpm-asdf
(:nicknames #:clpm-asdf)
(:use #:cl
#:clpm-asdf/concatenate-package-inferred-system-source-op
#:clpm-asdf/concatenate-source-deliver-asd-op
#:clpm-asdf/concatenate-source-deliver-asd-tarball-op)
(:reexport #:clpm-asdf/concatenate-package-inferred-system-source-op
#:clpm-asdf/concatenate-source-deliver-asd-op
#:clpm-asdf/concatenate-source-deliver-asd-tarball-op))
(in-package #:clpm-asdf/clpm-asdf)
;;;; Support for concatenating source files for a package inferred system
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-asdf/concatenate-package-inferred-system-source-op
(:use #:cl
#:asdf)
(:export #:concatenate-package-inferred-system-source-op))
(in-package #:clpm-asdf/concatenate-package-inferred-system-source-op)
(defclass concatenate-package-inferred-system-source-op
(asdf/concatenate-source::basic-concatenate-source-op
non-propagating-operation)
()
(:documentation
"An operation that concatenates all source files for a package inferred
system."))
(defun chase-parent (c)
(if (component-parent c)
(chase-parent (component-parent c))
c))
(defmethod asdf:input-files ((operation concatenate-package-inferred-system-source-op) (s system))
(check-type s package-inferred-system)
;; Only work on the primary system directly.
(assert (equal (primary-system-name s) (component-name s)))
(loop :with encoding = (or (component-encoding s) *default-encoding*)
:with other-encodings = '()
:with around-compile = (asdf::around-compile-hook s)
:with other-around-compile = '()
:with primary-system-name = (primary-system-name s)
:for c :in (required-components ;; see note about similar call to required-components
s :goal-operation 'load-op ;; in bundle.lisp
:keep-operation 'asdf::basic-compile-op
:other-systems t)
:append
(when (and (typep c 'cl-source-file)
(equal (primary-system-name (chase-parent c)) primary-system-name))
(let ((e (component-encoding c)))
(unless (equal e encoding)
(let ((a (assoc e other-encodings)))
(if a (push (component-find-path c) (cdr a))
(push (list a (component-find-path c)) other-encodings)))))
(unless (equal around-compile (asdf::around-compile-hook c))
(push (component-find-path c) other-around-compile))
(input-files (make-operation 'compile-op) c)) :into inputs
:finally
(when other-encodings
(warn "~S uses encoding ~A but has sources that use these encodings:~{ ~A~}"
operation encoding
(mapcar #'(lambda (x) (cons (car x) (list (reverse (cdr x)))))
other-encodings)))
(when other-around-compile
(warn "~S uses around-compile hook ~A but has sources that use these hooks: ~A"
operation around-compile other-around-compile))
(return inputs)))
;;;; Support for concatenating source and asd files for a package inferred
;;;; system
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-asdf/concatenate-source-deliver-asd-op
(:use #:cl
#:asdf
#:clpm-asdf/concatenate-package-inferred-system-source-op)
(:export #:concatenate-source-deliver-asd-op))
(in-package #:clpm-asdf/concatenate-source-deliver-asd-op)
(defclass concatenate-source-deliver-asd-op (selfward-operation)
((selfward-operation
:initform 'concatenate-package-inferred-system-source-op)))
(defmethod input-files ((op concatenate-source-deliver-asd-op) (s system))
(list (system-source-file s)
(output-file (selfward-operation op) s)))
(defmethod output-files ((op concatenate-source-deliver-asd-op) (c system))
(values (list (uiop:subpathname (component-pathname c)
(asdf::component-build-pathname c)
:type "asd")
(uiop:subpathname (component-pathname c)
(asdf::component-build-pathname c)
:type "lisp"))
t))
(defmethod perform ((op concatenate-source-deliver-asd-op) (c system))
(let ((output-asd-file (uiop:subpathname (component-pathname c)
(asdf::component-build-pathname c)
:type "asd"))
(output-lisp-file (output-file (selfward-operation op) c))
(desired-output-lisp-file (uiop:subpathname (component-pathname c)
(asdf::component-build-pathname c)
:type "lisp")))
(ensure-directories-exist output-asd-file)
(unless (uiop:pathname-equal output-lisp-file desired-output-lisp-file)
(uiop:copy-file output-lisp-file desired-output-lisp-file))
(with-open-file (s output-asd-file
:direction :output
:if-exists :supersede)
(uiop:with-safe-io-syntax (:package :asdf-user)
(let ((*print-case* :downcase))
(prin1 `(defsystem ,(component-name c)
:version ,(component-version c)
:description ,(system-description c)
:license ,(system-license c)
:components ((:file ,(pathname-name desired-output-lisp-file))))
s))))))
;;;; Support for concatenating source and asd files for a package inferred
;;;; system into a tarball.
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-asdf/concatenate-source-deliver-asd-tarball-op
(:use #:cl
#:archive
#:asdf
#:chipz
#:clpm-asdf/concatenate-source-deliver-asd-op
#:flexi-streams
#:salza2)
(:export #:concatenate-source-deliver-asd-tarball-op))
(in-package #:clpm-asdf/concatenate-source-deliver-asd-tarball-op)
(defclass concatenate-source-deliver-asd-tarball-op (selfward-operation)
((selfward-operation
:initform 'concatenate-source-deliver-asd-op)))
(defmethod input-files ((op concatenate-source-deliver-asd-tarball-op) (s system))
(output-files (selfward-operation op) s))
(defmethod output-files ((op concatenate-source-deliver-asd-tarball-op) (c system))
(values (list (uiop:subpathname (component-pathname c)
(asdf::component-build-pathname c)
:type "tar.gz"))
t))
(defmethod perform ((op concatenate-source-deliver-asd-tarball-op) (c system))
(with-open-stream (s (make-in-memory-output-stream))
(let ((archive (open-archive 'tar-archive s :direction :output))
(*default-pathname-defaults* (uiop:pathname-directory-pathname (output-file op c))))
(unwind-protect
(progn
(dolist (pn (output-files (selfward-operation op) c))
(let ((entry (create-entry-from-pathname archive (enough-namestring pn))))
(write-entry-to-archive archive entry)))
(finalize-archive archive))
(close-archive archive)))
(with-open-file (out (output-file op c) :direction :output
:element-type '(unsigned-byte 8)
:if-exists :supersede)
(gzip-stream (make-in-memory-input-stream (flexi-streams:get-output-stream-sequence s)) out))))
(uiop:define-package #:clpm/cli/client
(:use #:cl
#:alexandria
#:clpm/cli/common-args
#:clpm/cli/subcommands
#:clpm/client
#:clpm/log)
(:import-from #:adopt))
(in-package #:clpm/cli/client)
(setup-logger)
(defparameter *client-ui*
(adopt:make-interface
:name "clpm client"
:summary "Common Lisp Package Manager Client"
:usage "client [options]"
:help "Install the CLPM client"
:contents (list *group-common*)))
(define-cli-command (("client") *client-ui*) (args options)
(ensure-client-written)
(format *standard-output* "Client library located at:~%~A~%" (clpm-client-lib-location))
(let* ((contents (clpm-client-source-registry-conf.d-file-contents))
(pathname (clpm-client-source-registry-conf.d-file-name))
(write-p (yes-or-no-p "Would you like me to configure ASDF to find the client automatically?~%~%I will write the following to ~A:~%~%~A~%~%" pathname contents)))
(when write-p
(ensure-directories-exist pathname)
(with-open-file (s pathname :direction :output
:if-exists :supersede)
(write-string contents s)))))
(uiop:define-package #:clpm/client
(:use #:cl
#:clpm-asdf
#:clpm/archives
#:clpm/data
#:clpm/version
#:flexi-streams)
(:export #:clpm-client-lib-location
#:clpm-client-source-registry-conf.d-file-contents
#:clpm-client-source-registry-conf.d-file-name
#:ensure-client-written
#:write-client))
(in-package #:clpm/client)
(defvar *client-tarball* nil
"When dumping to an image, the client tarball is read in and stored in this
variable.")
(defun read-client-tarball ()
"Returns the client tarball as an octet vector."
(with-output-to-sequence (out :element-type '(unsigned-byte 8))
(with-open-file (in (asdf:output-file 'concatenate-source-deliver-asd-tarball-op :clpm-client)
:element-type '(unsigned-byte 8))
(uiop:copy-stream-to-stream in out :element-type '(unsigned-byte 8)))))
(defun cache-client-tarball ()
(setf *client-tarball* (read-client-tarball)))
(uiop:register-image-dump-hook 'cache-client-tarball)
(defun clpm-client-tarball-octets ()
"Returns an octet vector representing the client tarball. Prefers the cache
~*client-tarball*~."
(or *client-tarball*
(read-client-tarball)))
(defun clpm-client-lib-location ()
(clpm-data-pathname `("clpm-client" ,(concatenate 'string "clpm-client-" (clpm-version)))
:ensure-directory t))
(defun write-client (&key force)
(when (and (not force)
(uiop:probe-file* (clpm-client-lib-location)))
(error "Client already exists!"))
(unarchive 'gzipped-tar-archive (make-in-memory-input-stream (clpm-client-tarball-octets))
(uiop:pathname-directory-pathname (clpm-client-lib-location))))
(defun ensure-client-written ()
(unless (uiop:probe-file* (clpm-client-lib-location))
(write-client)))
(defun clpm-client-source-registry-string ()
(format nil "(:directory ~S)" (clpm-client-lib-location)))
(defun clpm-client-source-registry-conf.d-file-contents ()
"Return a string that can be written to a file in a source-registry.conf.d
directory for ASDF to find the CLPM client."
(concatenate 'string
";; -*- mode: common-lisp; -*-
;; Auto generated by CLPM version "
(clpm-version)
"
"
(clpm-client-source-registry-string)
"
"))
(defun clpm-client-source-registry-conf.d-file-name ()
"Return a string naming the default location to place an ASDF configuration
file to find the CLPM client."
(uiop:xdg-config-home "common-lisp" "source-registry.conf.d"
"20-clpm-client.conf"))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment