repair gui native-lib metadata generation

This commit is contained in:
Matthew Flatt 2018-04-17 15:44:03 -06:00
parent 959a57d31f
commit 65217898d1

View File

@ -41,11 +41,21 @@
"zlib1" "zlib1"
"libpangowin32-1.0.0")) "libpangowin32-1.0.0"))
(define mac-libs
'("PSMTabBarControl.framework"))
(define mac64-libs
'("MMTabBarView.framework"))
(define nonwin-libs (define nonwin-libs
'("libcrypto.1.1" '("libcrypto.1.1"
"libssl.1.1" "libssl.1.1"
"libuuid.1")) "libuuid.1"))
(define no-copy-libs
'("PSMTabBarControl.framework"
"MMTabBarView.framework"))
(define linux-libs (define linux-libs
(append (append
'("libXau.6" '("libXau.6"
@ -71,6 +81,7 @@
"" ; extra for "LICENSE.txt" "" ; extra for "LICENSE.txt"
#t ; dynamic libraries (as opposed to shared files) #t ; dynamic libraries (as opposed to shared files)
#f ; for-pkg name (e.g., "base"), of #f if the same as the pkg name #f ; for-pkg name (e.g., "base"), of #f if the same as the pkg name
#f ; version
(["libffi" "libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others."] (["libffi" "libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others."]
["libglib" "GLib is released under the GNU Library General Public License (GNU LGPL)."] ["libglib" "GLib is released under the GNU Library General Public License (GNU LGPL)."]
"libgio" "libgio"
@ -106,6 +117,7 @@
"" ""
#t #t
#f #f
#f
(["libeay32" ,(~a "This product includes software developed by the OpenSSL Project for\n" (["libeay32" ,(~a "This product includes software developed by the OpenSSL Project for\n"
"use in the OpenSSL Toolkit (http://www.openssl.org/).\n" "use in the OpenSSL Toolkit (http://www.openssl.org/).\n"
"\n" "\n"
@ -124,6 +136,7 @@
"" ""
#t #t
#f #f
#f
(["libgmp" "GNU MP is released under the GNU Lesser General Public License (GNU LGPL)."] (["libgmp" "GNU MP is released under the GNU Lesser General Public License (GNU LGPL)."]
["libmpfr" "MPFR is released under the GNU Lesser General Public License (GNU LGPL)."])] ["libmpfr" "MPFR is released under the GNU Lesser General Public License (GNU LGPL)."])]
@ -133,6 +146,7 @@
"" ""
#t #t
"draw" "draw"
#f
(["libX11.6" "libX11 is released under the X.Org Foundation license."] (["libX11.6" "libX11 is released under the X.Org Foundation license."]
["libXau.6" "libXau - Copyright 1988, 1993, 1994, 1998 The Open Group"] ["libXau.6" "libXau - Copyright 1988, 1993, 1994, 1998 The Open Group"]
["libxcb-shm.0" "libxcb - Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett."] ["libxcb-shm.0" "libxcb - Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett."]
@ -146,6 +160,7 @@
"" ""
#f #f
"draw" "draw"
#f
(["fonts" ,(~a "Fonts:\n" (["fonts" ,(~a "Fonts:\n"
" Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard\n" " Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard\n"
" Copyright © 2005 Patrick Lam\n" " Copyright © 2005 Patrick Lam\n"
@ -160,10 +175,13 @@
"" ""
#t #t
#f #f
"1.2" ; version
(["libgtk-x11-2.0.0" "GTK+ is released under the GNU Library General Public License (GNU LGPL)."] (["libgtk-x11-2.0.0" "GTK+ is released under the GNU Library General Public License (GNU LGPL)."]
["libatk" "ATK is released under the GNU Library General Public License (GNU LGPL)."] ["libatk" "ATK is released under the GNU Library General Public License (GNU LGPL)."]
"libgdk-x11-2.0.0" "libgdk-x11-2.0.0"
"libgdk_pixbuf-2.0.0")] "libgdk_pixbuf-2.0.0"
["PSMTabBarControl.framework" "PSMTabBarControl is BSD licensed.\nSee: http://www.positivespinmedia.com/dev/PSMTabBarControl.html"]
["MMTabBarView.framework" "MMTabBarView is BSD licensed.\nSee: http://mimo42.github.io/MMTabBarView/"])]
["db" ["db"
"" ""
@ -171,6 +189,7 @@
"" ""
#t #t
"base" "base"
#f
(["libsqlite3.0" "SQLite3 is in the public domain."] (["libsqlite3.0" "SQLite3 is in the public domain."]
["sqlite3" "SQLite3 is in the public domain."])] ["sqlite3" "SQLite3 is in the public domain."])]
@ -180,14 +199,19 @@
"" ""
#t #t
"racket-poppler" "racket-poppler"
#f
(["libpoppler" (["libpoppler"
;; Note: Poppler is GPL and *not* in the main Racket distribution (which is LGPL) ;; Note: Poppler is GPL and *not* in the main Racket distribution (which is LGPL)
"Poppler is released under the GNU General Public License (GNU GPL)."])])) "Poppler is released under the GNU General Public License (GNU GPL)."])]))
(define (libs-of-pkg p) (list-ref p 6)) (define (libs-of-pkg p) (list-ref p 7))
(define (framework? p)
(regexp-match? #rx"[.]framework" p))
(define (plain-path? p) (define (plain-path? p)
(equal? p "fonts")) (or (equal? p "fonts")
(framework? p)))
(define dest-dir (define dest-dir
(build-command-line (build-command-line
@ -216,7 +240,7 @@
(error 'install "cannot find package for library: ~e" lib)) (error 'install "cannot find package for library: ~e" lib))
(apply values pkg)) (apply values pkg))
(define (gen-info platform i-platform for-pkg pkg-name subdir libs lics lic-end lib?) (define (gen-info platform i-platform for-pkg pkg-name subdir libs lics lic-end lib? vers)
(define dest (build-path dest-dir pkg-name)) (define dest (build-path dest-dir pkg-name))
(define lib-path (build-path dest subdir "info.rkt")) (define lib-path (build-path dest subdir "info.rkt"))
(define top-path (build-path dest "info.rkt")) (define top-path (build-path dest "info.rkt"))
@ -231,7 +255,8 @@
(quote ,libs)) (quote ,libs))
o) o)
(define dirs (filter (lambda (lib) (define dirs (filter (lambda (lib)
(directory-exists? (build-path dest subdir lib))) (or (framework? lib)
(directory-exists? (build-path dest subdir lib))))
libs)) libs))
(unless (null? dirs) (unless (null? dirs)
(newline o) (newline o)
@ -243,7 +268,10 @@
(newline o) (newline o)
(pretty-write `(define pkg-desc ,(format "native libraries for \"~a\" package" for-pkg)) o) (pretty-write `(define pkg-desc ,(format "native libraries for \"~a\" package" for-pkg)) o)
(newline o) (newline o)
(pretty-write `(define pkg-authors '(mflatt)) o)) (pretty-write `(define pkg-authors '(mflatt)) o)
(when vers
(newline o)
(pretty-write `(define version ,vers) o)))
(unless same? (unless same?
(printf "Write ~a\n" lib-path) (printf "Write ~a\n" lib-path)
(call-with-output-file* (call-with-output-file*
@ -299,13 +327,14 @@
(define dest (build-path dir p)) (define dest (build-path dir p))
(let-values ([(base name dir?) (split-path dest)]) (let-values ([(base name dir?) (split-path dest)])
(make-directory* base)) (make-directory* base))
(cond (unless (member p no-copy-libs)
[(file-exists? dest) (delete-file dest)] (cond
[(directory-exists? dest) (delete-directory/files dest)]) [(file-exists? dest) (delete-file dest)]
(define src (build-path from p)) [(directory-exists? dest) (delete-directory/files dest)])
(if (directory-exists? src) (define src (build-path from p))
(copy-directory/files src dest) (if (directory-exists? src)
(copy-file src dest)) (copy-directory/files src dest)
(copy-file src dest)))
(unless (plain-path? p) (unless (plain-path? p)
(fixup p dest)) (fixup p dest))
@ -325,28 +354,30 @@
libs libs
(reverse (hash-ref pkgs-lic pkg null)) (reverse (hash-ref pkgs-lic pkg null))
(list-ref a 3) (list-ref a 3)
(list-ref a 4)))) (list-ref a 4)
(list-ref a 6))))
(define (install-mac) (define (install-mac)
(define (fixup p p-new) (define (fixup p p-new)
(printf "Fixing ~s\n" p-new) (unless (framework? p)
(unless (memq 'write (file-or-directory-permissions p-new)) (printf "Fixing ~s\n" p-new)
(file-or-directory-permissions p-new #o744)) (unless (memq 'write (file-or-directory-permissions p-new))
(system (format "install_name_tool -id ~a ~a" (file-name-from-path p-new) p-new)) (file-or-directory-permissions p-new #o744))
(for-each (lambda (s) (system (format "install_name_tool -id ~a ~a" (file-name-from-path p-new) p-new))
(system (format "install_name_tool -change ~a @loader_path/~a ~a" (for-each (lambda (s)
(format "~a/~a.dylib" from s) (system (format "install_name_tool -change ~a @loader_path/~a ~a"
(format "~a.dylib" s) (format "~a/~a.dylib" from s)
p-new))) (format "~a.dylib" s)
(append libs nonwin-libs)) p-new)))
(system (format "strip -S ~a" p-new))) (append libs nonwin-libs))
(system (format "strip -S ~a" p-new))))
(define platform (~a (if m32? (define platform (~a (if m32?
(if ppc? "ppc" "i386") (if ppc? "ppc" "i386")
"x86_64") "x86_64")
"-macosx")) "-macosx"))
(install platform platform "dylib" fixup (append libs nonwin-libs))) (install platform platform "dylib" fixup (append libs mac-libs (if m32? '() mac64-libs) nonwin-libs)))
(define (install-win) (define (install-win)
(define exe-prefix (if m32? (define exe-prefix (if m32?