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"
"libpangowin32-1.0.0"))
(define mac-libs
'("PSMTabBarControl.framework"))
(define mac64-libs
'("MMTabBarView.framework"))
(define nonwin-libs
'("libcrypto.1.1"
"libssl.1.1"
"libuuid.1"))
(define no-copy-libs
'("PSMTabBarControl.framework"
"MMTabBarView.framework"))
(define linux-libs
(append
'("libXau.6"
@ -71,6 +81,7 @@
"" ; extra for "LICENSE.txt"
#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 ; version
(["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)."]
"libgio"
@ -106,6 +117,7 @@
""
#t
#f
#f
(["libeay32" ,(~a "This product includes software developed by the OpenSSL Project for\n"
"use in the OpenSSL Toolkit (http://www.openssl.org/).\n"
"\n"
@ -124,6 +136,7 @@
""
#t
#f
#f
(["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)."])]
@ -133,6 +146,7 @@
""
#t
"draw"
#f
(["libX11.6" "libX11 is released under the X.Org Foundation license."]
["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."]
@ -146,6 +160,7 @@
""
#f
"draw"
#f
(["fonts" ,(~a "Fonts:\n"
" Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard\n"
" Copyright © 2005 Patrick Lam\n"
@ -160,10 +175,13 @@
""
#t
#f
"1.2" ; version
(["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)."]
"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"
""
@ -171,6 +189,7 @@
""
#t
"base"
#f
(["libsqlite3.0" "SQLite3 is in the public domain."]
["sqlite3" "SQLite3 is in the public domain."])]
@ -180,14 +199,19 @@
""
#t
"racket-poppler"
#f
(["libpoppler"
;; 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)."])]))
(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)
(equal? p "fonts"))
(or (equal? p "fonts")
(framework? p)))
(define dest-dir
(build-command-line
@ -216,7 +240,7 @@
(error 'install "cannot find package for library: ~e" lib))
(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 lib-path (build-path dest subdir "info.rkt"))
(define top-path (build-path dest "info.rkt"))
@ -231,7 +255,8 @@
(quote ,libs))
o)
(define dirs (filter (lambda (lib)
(directory-exists? (build-path dest subdir lib)))
(or (framework? lib)
(directory-exists? (build-path dest subdir lib))))
libs))
(unless (null? dirs)
(newline o)
@ -243,7 +268,10 @@
(newline o)
(pretty-write `(define pkg-desc ,(format "native libraries for \"~a\" package" for-pkg)) 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?
(printf "Write ~a\n" lib-path)
(call-with-output-file*
@ -299,13 +327,14 @@
(define dest (build-path dir p))
(let-values ([(base name dir?) (split-path dest)])
(make-directory* base))
(cond
[(file-exists? dest) (delete-file dest)]
[(directory-exists? dest) (delete-directory/files dest)])
(define src (build-path from p))
(if (directory-exists? src)
(copy-directory/files src dest)
(copy-file src dest))
(unless (member p no-copy-libs)
(cond
[(file-exists? dest) (delete-file dest)]
[(directory-exists? dest) (delete-directory/files dest)])
(define src (build-path from p))
(if (directory-exists? src)
(copy-directory/files src dest)
(copy-file src dest)))
(unless (plain-path? p)
(fixup p dest))
@ -325,28 +354,30 @@
libs
(reverse (hash-ref pkgs-lic pkg null))
(list-ref a 3)
(list-ref a 4))))
(list-ref a 4)
(list-ref a 6))))
(define (install-mac)
(define (fixup p p-new)
(printf "Fixing ~s\n" p-new)
(unless (memq 'write (file-or-directory-permissions p-new))
(file-or-directory-permissions p-new #o744))
(system (format "install_name_tool -id ~a ~a" (file-name-from-path p-new) p-new))
(for-each (lambda (s)
(system (format "install_name_tool -change ~a @loader_path/~a ~a"
(format "~a/~a.dylib" from s)
(format "~a.dylib" s)
p-new)))
(append libs nonwin-libs))
(system (format "strip -S ~a" p-new)))
(unless (framework? p)
(printf "Fixing ~s\n" p-new)
(unless (memq 'write (file-or-directory-permissions p-new))
(file-or-directory-permissions p-new #o744))
(system (format "install_name_tool -id ~a ~a" (file-name-from-path p-new) p-new))
(for-each (lambda (s)
(system (format "install_name_tool -change ~a @loader_path/~a ~a"
(format "~a/~a.dylib" from s)
(format "~a.dylib" s)
p-new)))
(append libs nonwin-libs))
(system (format "strip -S ~a" p-new))))
(define platform (~a (if m32?
(if ppc? "ppc" "i386")
"x86_64")
"-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 exe-prefix (if m32?