|
| 1 | +(defpackage #:tecgraf-libs |
| 2 | + (:use #:common-lisp)) |
| 3 | + |
| 4 | +(in-package #:tecgraf-libs) |
| 5 | + |
| 6 | +(defvar *archives* |
| 7 | + #+linux |
| 8 | + '("https://sourceforge.net/projects/iup/files/3.25/Linux%20Libraries/iup-3.25_Linux44_64_lib.tar.gz" |
| 9 | + "https://sourceforge.net/projects/canvasdraw/files/5.11.1/Linux%20Libraries/cd-5.11.1_Linux44_64_lib.tar.gz" |
| 10 | + "https://sourceforge.net/projects/imtoolkit/files/3.12/Linux%20Libraries/im-3.12_Linux44_64_lib.tar.gz") |
| 11 | + #+windows |
| 12 | + '("https://sourceforge.net/projects/iup/files/3.25/Windows%20Libraries/Dynamic/iup-3.25_Win64_dllw6_lib.zip" |
| 13 | + "https://sourceforge.net/projects/canvasdraw/files/5.11.1/Windows%20Libraries/Dynamic/cd-5.11.1_Win64_dllw6_lib.zip" |
| 14 | + "https://sourceforge.net/projects/imtoolkit/files/3.12/Windows%20Libraries/Dynamic/im-3.12_Win64_dllw6_lib.zip")) |
| 15 | + |
| 16 | +(defconstant +buffer-size+ (* 1024 1024)) |
| 17 | + |
| 18 | +(defun download () |
| 19 | + (dolist (archive *archives*) |
| 20 | + (format t "~&~A~%" archive) |
| 21 | + (finish-output) |
| 22 | + (let* ((archive-pathname (path:basename (puri:uri-path (puri:parse-uri archive)))) |
| 23 | + (output-pathname (asdf:system-relative-pathname :tecgraf-libs archive-pathname))) |
| 24 | + (with-open-file |
| 25 | + (output-stream output-pathname :direction :output :if-exists :supersede :element-type '(unsigned-byte 8)) |
| 26 | + (multiple-value-bind |
| 27 | + (input-stream status-code) |
| 28 | + (drakma:http-request archive :verify :required :want-stream t) |
| 29 | + (if (= status-code 200) |
| 30 | + (loop with buffer = (make-array +buffer-size+ :element-type '(unsigned-byte 8)) |
| 31 | + for read-count = (read-sequence buffer input-stream) |
| 32 | + do (write-sequence buffer output-stream :end read-count) |
| 33 | + while (= read-count +buffer-size+)) |
| 34 | + (error "Error downloading archive ~A" archive))))))) |
| 35 | + |
| 36 | + |
| 37 | +;;; download the files securely |
| 38 | +;;; unpack them |
| 39 | +;;; patchelf for ORIGIN |
| 40 | +;;; copy to asdf target location |
| 41 | + |
0 commit comments