configure: add --enable-natipkg and 64-bit Linux native libraries

The `--enable-natipkg` configuration option adds "-natipkg" to the
platform library subpath. The suffix is intended to trigger the
installation of packages that supply native libraries for supported
platforms (where 64-bit Linux is the supported platform, for now, for
main-distribution packages), instead of relying on libraries installed
via the OS's package manager.

The intended client for "-natipkg" is the package-build service, where
installing packages via the OS package manager would require network
access and either trust or constrained installations. The build
machine is intentionally disconnected from the network and can only
access Racket packages, so repackaging native libraries as Racket
packages makes those libraries accessible.

A disadvantage of this approach to installing native libraries is that
it creates work for implementers of packages that access native
libraries. Those implementers will have to supply packages for 64-bit
Linux versions of native libraries to the degree needed to build and
(eventually) test the package. An advantage of the approach is that it
requires no changes to the package system; it will be cheap to replace
this approach if we find a better way to deal with native libraries
and/or OS packages in the package-build service.
This commit is contained in:
Matthew Flatt 2014-10-06 14:13:12 -06:00
parent e50e2eaa57
commit 40f5ec070a
18 changed files with 747 additions and 107 deletions

View File

@ -107,6 +107,9 @@ The "native-pkgs" directory is a git submodule, so you'll need
before you do anything else.
The "native-pkgs" directory is also needed if you build for 64-bit
Linux with the `--enable-natipkg` option to `configure`.
More Instructions: Building Racket
==================================

@ -1 +1 @@
Subproject commit 4bc36e704d0ce4d84788e538ca49f71a8b73c07f
Subproject commit 2f116c1b64af3f980a403cb4b57051457b2a9c39

View File

@ -8,7 +8,10 @@
("draw-x86_64-macosx-2" #:platform "x86_64-macosx")
("draw-ppc-macosx-2" #:platform "ppc-macosx")
("draw-win32-i386-2" #:platform "win32\\i386")
("draw-win32-x86_64-2" #:platform "win32\\x86_64")))
("draw-win32-x86_64-2" #:platform "win32\\x86_64")
("draw-x86_64-linux-natipkg-2" #:platform "x86_64-linux-natipkg")
("draw-x11-x86_64-linux-natipkg" #:platform "x86_64-linux-natipkg")
("draw-ttf-x86_64-linux-natipkg" #:platform "x86_64-linux-natipkg")))
(define pkg-desc "implementation (no documentation) part of \"draw\"")

View File

@ -2,26 +2,52 @@
(require ffi/unsafe
ffi/unsafe/define
ffi/unsafe/alloc
setup/dirs
"../private/libs.rkt"
"../private/utils.rkt")
(define-runtime-lib cairo-lib
[(unix) (ffi-lib "libcairo" '("2" ""))]
(define-runtime-lib fontconfig-lib
[(unix) (ffi-lib "libfontconfig" '("1" ""))]
[(macosx)
(ffi-lib "libpixman-1.0.dylib")
(ffi-lib "libpng16.16.dylib")
(ffi-lib "libexpat.1.dylib")
(ffi-lib "libfreetype.6.dylib")
(ffi-lib "libfontconfig.1.dylib")
(ffi-lib "libcairo.2.dylib")]
(ffi-lib "libfontconfig.1.dylib")]
[(windows)
(ffi-lib "zlib1.dll")
(ffi-lib "libintl-8.dll")
(ffi-lib "libpng16-16.dll")
(ffi-lib "libexpat-1.dll")
(ffi-lib "libfreetype-6.dll")
(ffi-lib "libfontconfig-1.dll")
(ffi-lib "libfontconfig-1.dll")])
(define-runtime-lib cairo-lib
[(unix) (ffi-lib "libcairo" '("2" ""))]
[(macosx)
(ffi-lib "libpixman-1.0.dylib")
(ffi-lib "libcairo.2.dylib")]
[(windows)
(ffi-lib "libpixman-1-0.dll")
(ffi-lib "libcairo-2.dll")])
;; A Racket-specific patch to Fontconfig defines FcSetFallbackDirs(),
;; which lets us set default paths to point to a Racket-specific
;; directory. If FcSetFallbackDirs() isn't defined, then we want
;; the system-defined directories, anyway.
(let ([FcSetFallbackDirs (get-ffi-obj 'FcSetFallbackDirs
fontconfig-lib
(_fun _path _path -> _void)
(lambda () #f))]
[FcSetConfigDir (get-ffi-obj 'FcSetConfigDir
fontconfig-lib
(_fun _path -> _void)
(lambda () #f))])
(when (and FcSetFallbackDirs
FcSetConfigDir)
(define share-dir (find-share-dir))
(when share-dir
(FcSetFallbackDirs (build-path share-dir "fonts")
(build-path (find-system-path 'addon-dir) "font-cache"))
(FcSetConfigDir (build-path share-dir "fonts")))))
(provide (protect-out cairo-lib))

View File

@ -21,7 +21,8 @@
("gui-x86_64-macosx" #:platform "x86_64-macosx")
("gui-ppc-macosx" #:platform "ppc-macosx")
("gui-win32-i386" #:platform "win32\\i386")
("gui-win32-x86_64" #:platform "win32\\x86_64")))
("gui-win32-x86_64" #:platform "win32\\x86_64")
("gui-x86_64-linux-natipkg" #:platform "x86_64-linux-natipkg")))
(define build-deps '("at-exp-lib"
"rackunit-lib"))

View File

@ -10,7 +10,8 @@
("math-x86_64-macosx" #:platform "x86_64-macosx")
("math-ppc-macosx" #:platform "ppc-macosx")
("math-win32-i386" #:platform "win32\\i386")
("math-win32-x86_64" #:platform "win32\\x86_64")))
("math-win32-x86_64" #:platform "win32\\x86_64")
("math-x86_64-linux-natipkg" #:platform "x86_64-linux-natipkg")))
(define build-deps '())

View File

@ -8,6 +8,7 @@
("db-ppc-macosx" #:platform "ppc-macosx")
("db-win32-i386" #:platform "win32\\i386")
("db-win32-x86_64" #:platform "win32\\x86_64")
("db-x86_64-linux-natipkg" #:platform "x86_64-linux-natipkg")
("com-win32-i386" #:platform "win32\\i386")
("com-win32-x86_64" #:platform "win32\\x86_64")))

17
racket/src/configure vendored
View File

@ -796,6 +796,7 @@ enable_origtree
enable_pkgscope
enable_docs
enable_usersetup
enable_natipkg
enable_shared
enable_dynlib
enable_lt
@ -1441,6 +1442,7 @@ Optional Features:
--enable-pkgscope=<s> set `raco pkg' default: installation, user, or shared
--enable-docs build docs on install (enabled by default)
--enable-usersetup setup user-specific files on install
--enable-natipkg add "-natipkg" to library subpath
--enable-shared create shared libraries (ok, but not recommended)
--enable-dynlib same as --enable-shared
--enable-lt=<prog> use <prog> instead of libtool; disable to use bundled
@ -2651,6 +2653,12 @@ if test "${enable_usersetup+set}" = set; then :
enableval=$enable_usersetup;
fi
# Check whether --enable-natipkg was given.
if test "${enable_natipkg+set}" = set; then :
enableval=$enable_natipkg;
fi
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared;
@ -2987,6 +2995,7 @@ show_explicitly_enabled "${enable_cgcdefault}" "CGC as default" "Note that this
show_explicitly_disabled "${enable_docs}" "Documentation build"
show_explicitly_enabled "${enable_usersetup}" "User-specific setup on install"
show_explicitly_enabled "${enable_natipkg}" "Adding \"-natipkg\" suffix to library subpath"
show_explicitly_enabled "${enable_xonx}" "Unix style"
show_explicitly_enabled "${enable_shared}" "Shared libraries"
@ -6515,6 +6524,14 @@ if test "${enable_docs}" = "no" ; then
INSTALL_SETUP_FLAGS="${INSTALL_SETUP_FLAGS} --no-docs"
fi
############## natipkg ################
if test "${enable_natipkg}" = "yes" ; then
$as_echo "#define SPLS_SUFFIX \"-natipkg\"" >>confdefs.h
fi
############## Racket for Racket ################
if test "${enable_racket}" = "" ; then

View File

@ -6,19 +6,22 @@ variants, we expect users to install C-implemented libraries (usually
through the operating system's package manager). For Windows and Mac
OS X, we supply pre-built libraries in platform-specific packages; the
corresponding Racket packages include platform-specific dependencies
on those packages.
on those packages. The "x86_64-linux-natipkg" variant of Racket
is like Windows and Mac OS X, expecting packages to supply native
libraries for 64-bit Linux.
This directory contains scripts and patches to build Windows and Mac
OS X libraries in a consistent and portable way. Naturally, the script
and patches are fragile, so we upgrade libraries
This directory contains scripts and patches to build Windows, Mac OS
X, and Linux libraries in a consistent and portable way. Naturally,
the script and patches are fragile, so we upgrade libraries
infrequently. Currently, we use the following external packages and
versions:
pkg-config-0.28
sed-4.2 (Windows only, to avoid non-GNU `sed')
openssl-1.0.1g (Windows only)
sqlite[-autoconf]-3080600 (Windows and Linux only)
openssl-1.0.1g (Windows and Linux only)
libiconv-1.14 (Windows only)
zlib-1.2.8 (Windows only)
zlib-1.2.8 (Windows and Linux only)
libffi-3.0.13
expat-2.1.0
gettext-0.18.3.2
@ -35,9 +38,27 @@ versions:
mpfr-3.1.2
gmp-5.1.3
The above lists is aimed at the graphics stack, and there are a few
more libraries not covered here, yet. See "../mac/README.txt" and
"../worksp/README" for more information.
(Linux only:)
xtrans-1.3.5
inputproto-2.3.1
xextproto-7.3.0
kbproto-1.0.5
xproto-7.0.26
xcb-proto-1.11
renderproto-0.11.1
libpthread-stubs-0.3
libxcb-1.11
libXau-1.0.8
libX11-1.6.2
libXext-1.3.3
libXrender-0.9.8
freefont[-ttf]-20100919
atk-2.12.0
gdk-pixbuf-2.30.8
gtk+-2.24.24
See "../mac/README.txt" for information about an additional
library on Mac OS X.
Preliminiaries
--------------
@ -68,6 +89,11 @@ Clang, then note that you'll need gcc-4.0 --- but the Pango version
listed above relies on CoreText, which is available only with 10.5 and
later.
For Linux:
The script assumes that `gcc`, `g++`, `m4`, and `chrpath` are
installed, as well as X11 header files.
Build Steps (assuming no version changes)
-----------
@ -80,7 +106,7 @@ Build Steps (assuming no version changes)
* Run
racket <here-dir>/build-all.rkt \
--{win,mac} \
--{win,mac,linux} \
--m{32,64} \
--archives <archive-dir>
@ -91,7 +117,7 @@ Build Steps (assuming no version changes)
* Run
racket <here-dir>/install.rkt \
--{win,mac} \
--{win,mac,linux} \
--m{32,64} \
<native-pkgs-dir>
@ -158,6 +184,16 @@ More details for Mac OS X:
look for "TWOLEVEL" in the output to double check that a library
build uses two-level namespaces.
More details for Linux:
* The `chrpath` tool is used to set the RAPTH of each generated
library to `$ORIGIN` so that other shared libraries will be found
when they are installed in the same package scope.
* A minimal set of fonts is installed in the installation's "share"
directory under "fonts". The Fontconfig package is patched to
redirect the default configuration location to that directory.
When Library Versions Change
----------------------------

View File

@ -2,21 +2,46 @@
(require racket/system
racket/format
racket/runtime-path
racket/list
"cmdline.rkt")
(define (get-package-names win?)
(append
'("pkg-config")
(if win?
'("sed"
"longdouble"
"libiconv"
"openssl"
"zlib")
null)
(cond
[win?
'("sed"
"longdouble"
"libiconv")]
[else
null])
(cond
[(or win? linux?)
'("sqlite"
"openssl"
"zlib")]
[else
null])
'("expat"
"gettext"
"libffi"
"gettext")
(cond
[linux?
'("inputproto"
"xproto"
"xtrans"
"kbproto"
"xextproto"
"renderproto"
"libpthread-stubs"
"libXau"
"xcb-proto"
"libxcb"
"libX11"
"libXext"
"libXrender"
"freefont")]
[else null])
'("libffi"
"glib"
"libpng"
"freetype"
@ -28,7 +53,13 @@
"gmp"
"mpfr"
"jpeg"
"poppler")))
"poppler")
(cond
[linux?
'("gdk-pixbuf"
"atk"
"gtk+")]
[else null])))
(define-runtime-path build-rkt "build.rkt")
@ -45,8 +76,12 @@
(printf "Building ~a\n" package-name)
(parameterize ([current-namespace (make-base-namespace)]
[current-command-line-arguments
(vector (if win? "--win" "--mac")
(if m32? (if ppc? "--mppc" "--m32") "--m64")
"--archives" (~a archives-dir)
package-name)])
(list->vector
(append
(list (if win? "--win" (if linux? "--linux" "--mac"))
(if m32? (if ppc? "--mppc" "--m32") "--m64"))
(cons "--archives"
(add-between (map ~a archives-dirs)
"--archives"))
(list package-name)))])
(dynamic-require build-rkt #f))]))

View File

@ -86,8 +86,11 @@
(printf "echo '\tcp longdouble.dll ../dest/bin' >> Makefile\n")))
(file-or-directory-permissions "longdouble-1/configure" #o777)]
[else
(define archive (parameterize ([current-directory archives-dir])
(build-path archives-dir (find-package package-name #f))))
(define archive (or (for/or ([archives-dir (in-list archives-dirs)])
(parameterize ([current-directory archives-dir])
(define p (find-package package-name #f #t))
(and p (build-path archives-dir p))))
(find-package package-name #f)))
(define dir (find-package package-name #t #t))
(when dir
(printf "Removing ~a" dir)
@ -142,6 +145,10 @@
(define-runtime-path libtool-link-patch "patches/libtool-link.patch")
(define-runtime-path libtool64-link-patch "patches/libtool64-link.patch")
;; Add FcSetFallbackDirs to set fallback directories dynamically:
(define-runtime-path fcdirs-patch "patches/fcdirs.patch")
(define-runtime-path fonts-conf "patches/fonts.conf")
;; --------------------------------------------------
;; General environment and flag configuration:
@ -171,16 +178,26 @@
;; We'd prefer to add "-static-libgcc" to CFLAGS, but
;; libtool doesn't pass `static-libgcc` through.
(list "CC" (~a win-prefix "-gcc -static-libgcc")))])]
[m32?
(define sdk-flags (sdk 5))
(list
(list "CPPFLAGS" (~a "-m32" sdk-flags))
(list "LDFLAGS" (~a "-m32" sdk-flags)))]
[mac?
(cond
[m32?
(define sdk-flags (sdk 5))
(list
(list "CPPFLAGS" (~a "-m32" sdk-flags))
(list "LDFLAGS" (~a "-m32" sdk-flags)))]
[else
(define sdk-flags (sdk 6))
(list
(list "CPPFLAGS" (~a "-m64" sdk-flags))
(list "LDFLAGS" (~a "-m64" sdk-flags)))])]
[else
(define sdk-flags (sdk 6))
(list
(list "CPPFLAGS" (~a "-m64" sdk-flags))
(list "LDFLAGS" (~a "-m64" sdk-flags)))]))
(cond
[m32?
(list
(list "CPPFLAGS" "-m32")
(list "LDFLAGS" "-m32"))]
[else
null])]))
(define cxx-env
(if win?
@ -238,6 +255,7 @@
#:configure-exe [exe #f]
#:configure [args null]
#:make [make "make"]
#:make-install [make-install (~a make " install")]
#:setup [setup null]
#:patches [patches null]
#:post-patches [post-patches null]
@ -251,32 +269,54 @@
deps))])
(unless (file-exists? (build-path dest "stamps" d))
(error 'build "prerequisite needed: ~a" d)))
(values env exe args make setup patches post-patches fixup))
(values env exe args make make-install setup patches post-patches fixup))
(define path-flags
(list (list "CPPFLAGS" (~a "-I" dest "/include"))
(list "LDFLAGS" (~a "-L" dest "/lib"))))
(define (windows-only)
(unless win?
(error (format "build ~a only for Windows" package-name))))
(define ld-library-path-flags
(list (list "LD_LIBRARY_PATH"
(path->string (build-path dest "lib")))))
(define-values (extra-env configure-exe extra-args make-command setup patches post-patches fixup)
(define (nonmac-only)
(unless (or win? linux?)
(error (format "build ~a only for Windows or Linux" package-name))))
(define (linux-only)
(unless linux?
(error (format "build ~a only for Linux" package-name))))
(define-values (extra-env configure-exe extra-args make-command make-install-command
setup patches post-patches fixup)
(case package-name
[("pkg-config") (config #:configure (list "--with-internal-glib"))]
[("sed") (config)]
[("longdouble") (config)]
[("libiconv")
(windows-only)
(nonmac-only)
(config)]
[("sqlite")
(nonmac-only)
(config #:fixup (and win?
(~a "cd " (build-path dest "bin")
" && mv libsqlite3-0.dll sqlite3.dll")))]
[("openssl")
(windows-only)
(nonmac-only)
(config #:configure-exe (find-executable-path "sh")
#:configure (list "./Configure"
(~a "--cross-compile-prefix=" win-prefix "-")
#f ; other flags here
(~a "mingw" (if m32? "" "64"))
"shared"))]
#:configure (if win?
(list "./Configure"
(~a "--cross-compile-prefix=" win-prefix "-")
#f ; other flags here
(~a "mingw" (if m32? "" "64"))
"shared")
(list "./Configure"
#f
"shared"
"linux-x86_64"))
#:make (if linux?
(~a "make SHARED_LDFLAGS=" "-Wl,-rpath," dest "/lib")
"make"))]
[("expat") (config)]
[("gettext") (config #:depends (if win? '("libiconv") '())
#:configure '("--enable-languages=c")
@ -285,20 +325,62 @@
;; only that avoids other problems.
"cd gettext-runtime/intl && make"
"make"))]
[("inputproto"
"xproto"
"xtrans"
"kbproto"
"xextproto"
"renderproto"
"libpthread-stubs"
"libXau"
"xcb-proto"
"libxcb"
"libX11"
"libXext"
"libXrender")
(linux-only)
(config #:env path-flags)]
[("gdk-pixbuf")
(linux-only)
(config #:depends '("libX11")
#:configure '("--without-libtiff")
#:env (append path-flags
ld-library-path-flags))]
[("atk")
(linux-only)
(config #:depends '("libX11")
#:env (append path-flags
ld-library-path-flags))]
[("gtk+")
(linux-only)
(config #:depends '("gdk-pixbuf" "atk" "libXrender")
#:env (append path-flags
ld-library-path-flags))]
[("freefont")
(config #:configure-exe (find-executable-path "echo")
#:make (~a "cp " fonts-conf " .")
#:make-install (~a "rm -rf " dest "/lib/fonts"
" && mkdir -p " dest "/lib/fonts"
" && cp fonts.conf"
" FreeMono.ttf"
" FreeSans.ttf"
" FreeSerif.ttf"
" " dest "/lib/fonts"))]
[("libffi") (config)]
[("zlib")
(windows-only)
(config #:make (~a "make -f win32/Makefile.gcc"
" PREFIX=" win-prefix "-"
" INCLUDE_PATH=" dest "/include"
" LIBRARY_PATH=" dest "/lib"
" BINARY_PATH=" dest "/bin"
" LDFLAGS=-static-libgcc")
#:fixup (~a "cp zlib1.dll " dest "/bin && cp libz.dll.a " dest "/lib"))]
(nonmac-only)
(config #:make (if win?
(~a "make -f win32/Makefile.gcc"
" PREFIX=" win-prefix "-"
" INCLUDE_PATH=" dest "/include"
" LIBRARY_PATH=" dest "/lib"
" BINARY_PATH=" dest "/bin"
" LDFLAGS=-static-libgcc")
"make")
#:fixup (and win?
(~a "cp zlib1.dll " dest "/bin && cp libz.dll.a " dest "/lib")))]
[("glib") (config #:depends (append '("libffi" "gettext")
(if win?
'("libiconv")
'()))
(if win? '("libiconv") '()))
#:env (append path-flags
;; Disable Valgrind support, which particularly
;; goes wrong for 64-bit Windows builds.
@ -306,17 +388,29 @@
#:patches (if (and win? m32?)
(list rand-patch)
null))]
[("libpng") (config #:depends (if win? '("zlib") '())
#:env (if win? path-flags null))]
[("libpng") (config #:depends (if (or win? linux?) '("zlib") '())
#:env (if (or linux? win?)
(append
path-flags
(if linux?
(list (list "LDFLAGS" (~a "-Wl,-rpath," dest "/lib")))
null))
null))]
[("freetype") (config #:depends '("libpng"))]
[("fontconfig") (config #:depends '("expat" "freetype")
#:configure '("--disable-docs"))]
#:configure '("--disable-docs")
#:patches (list fcdirs-patch))]
[("pixman") (config #:patches (if (and win? (not m32?))
(list noforceinline-patch)
null))]
[("cairo") (config #:depends '("pixman" "fontconfig" "freetype" "libpng")
[("cairo") (config #:depends (append '("pixman" "fontconfig" "freetype" "libpng")
(if linux?
'("libX11" "libXrender")
null))
#:env path-flags
#:configure '("--enable-xlib=no")
#:configure (if (not linux?)
'("--enable-xlib=no")
null)
#:patches (list cairo-coretext-patch
courier-new-patch
win32cairofallback-patch))]
@ -328,9 +422,12 @@
#:env cxx-env)]
[("pango") (config #:depends '("cairo" "harfbuzz")
#:env (if win? path-flags null)
#:configure '("--without-x"
"--with-included-modules=yes"
"--with-dynamic-modules=no")
#:configure (append
(if (not linux?)
'("--without-x")
null)
'("--with-included-modules=yes"
"--with-dynamic-modules=no"))
#:patches (list coretext-patch
win32text-patch))]
[("gmp") (config #:patches (if gcc-4.0? (list gmp-weak-patch) null)
@ -352,8 +449,8 @@
libtool64-link-patch))
null)
#:configure '("--enable-zlib"
"--disable-splash-output"
"--disable-poppler-cpp"))]
"--disable-splash-output"
"--disable-poppler-cpp"))]
[else (error 'build "unrecognized package: ~a" package-name)]))
;; --------------------------------------------------
@ -397,7 +494,7 @@
(for ([p (in-list post-patches)])
(system/show (~a "patch -p2 < " p))))
(system/show make-command)
(system/show (~a make-command " install"))
(system/show make-install-command)
(when fixup
(system/show fixup))
(stamp package-name)

View File

@ -2,23 +2,25 @@
(require racket/cmdline)
(provide build-command-line
m32? win? mac? ppc?
archives-dir)
m32? win? mac? linux? ppc?
archives-dirs)
(define m32? 'unknown)
(define win? 'unknown)
(define linux? #f)
(define mac? 'unknown)
(define ppc? #f)
(define archives-dir (current-directory))
(define archives-dirs #f)
(define-syntax-rule (build-command-line c ...)
(let ()
(define m32? 'unknown)
(define win? 'unknown)
(define mac? 'unknown)
(define linux? #f)
(define ppc? (regexp-match? #rx"ppc" (system-library-subpath #f)))
(define archives-dir (current-directory))
(define archives-dirs #f)
(begin0
(command-line
#:once-any
@ -26,6 +28,9 @@
(set! win? #t)]
[("--mac") "build for/on Mac OS X"
(set! win? #f)]
[("--linux") "build for/on Linux"
(set! win? #f)
(set! linux? #t)]
#:once-any
[("--m32") "build 32-bit mode x86/PowerPC"
(set! m32? #t)]
@ -34,22 +39,26 @@
[("--mppc") "build 32-bit mode PowerPC"
(set! m32? #t)
(set! ppc? #t)]
#:once-each
#:multi
[("--archives") dir "Find archives in <dir>"
(set! archives-dir dir)]
(set! archives-dirs (cons dir (or archives-dirs null)))]
#:once-each
c ...)
(when (eq? win? 'unknown)
(error 'build "please pick `--win` or `--mac`"))
(error 'build "please pick `--win`, `--mac`, or `--linux`"))
(when (eq? m32? 'unknown)
(error 'build "please pick `--m32` or `--m64`"))
(when (and ppc? (not m32?))
(error 'build "cannot use `--m64` on PowerPC"))
(set! mac? (not win?))
(install! m32? win? mac? (and mac? ppc?) archives-dir))))
(set! mac? (not (or win? linux?)))
(install! m32? win? mac? linux? (and mac? ppc?)
(reverse (or archives-dirs
(list (current-directory))))))))
(define (install! -m32? -win? -mac? -ppc? -archives-dir)
(define (install! -m32? -win? -mac? -linux? -ppc? -archives-dirs)
(set! m32? -m32?)
(set! win? -win?)
(set! mac? -mac?)
(set! linux? -linux?)
(set! ppc? -ppc?)
(set! archives-dir -archives-dir))
(set! archives-dirs -archives-dirs))

View File

@ -34,15 +34,39 @@
'("libiconv-2"
"libeay32"
"ssleay32"
"sqlite3"
"longdouble"
"zlib1"
"libpangowin32-1.0.0"))
(define linux-libs
(append
'("libXau.6"
"libxcb-shm.0"
"libxcb-render.0"
"libxcb.1"
"libX11.6"
"libXext.6"
"libXrender.1"
"fonts")
'("libcrypto.1.0.0"
"libssl.1.0.0"
"libz.1"
"libsqlite3.0")
'("libgtk-x11-2.0.0"
"libgdk-x11-2.0.0"
"libatk-1.0.0"
"libgdk_pixbuf-2.0.0")))
(define linux-remove-libs
'("libintl.8"))
(define package-mapping
`(["draw" ; pkg name
"-2" ; pkg suffix (increment after "-" when library versions change)
"racket/draw" ; subdir
"" ; 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
(["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"
@ -68,16 +92,22 @@
["libpixman" "Pixman is relased under a MIT license."]
["libpng" "Libpng is released under the libpng license."]
["libjpeg" "This software is based in part on the work of the Independent JPEG Group."]
["zlib1" "zlib is by Jean-loup Gailly and Mark Adler."])]
["zlib1" "zlib is by Jean-loup Gailly and Mark Adler."]
["libz" "zlib is by Jean-loup Gailly and Mark Adler."])]
["racket"
"-2"
"racket"
""
#t
#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"
"Eric Young is the author of libeay and ssleay.")]
"ssleay32"
["libssl" ,(~a "This product includes software developed by the OpenSSL Project for\n"
"use in the OpenSSL Toolkit (http://www.openssl.org/).\n")]
"libcrypto"
["libiconv-2" "libiconv is released under the GNU Lesser General Public License (GNU LGPL)."]
["longdouble" ,(~a "The source to longdouble is included with the Racket source code,\n"
"which is available from\n"
@ -86,17 +116,72 @@
""
"math"
""
#t
#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)."])]
["draw-x11"
""
"racket/draw/x11"
""
#t
"draw"
(["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."]
"libxcb-render.0"
"libxcb.1"
["libXext.6" "libXext - Copyright 1986, 1987, 1988, 1989, 1994, 1998 The Open Group"]
["libXrender.1" "libXrender - Copyright © 2001,2003 Keith Packard"])]
["draw-ttf"
""
"racket/draw/ttf"
""
#f
"draw"
(["fonts" ,(~a "Fonts:\n"
" Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard\n"
" Copyright © 2005 Patrick Lam\n"
" Copyright © 2009 Roozbeh Pournader\n"
" Copyright © 2008,2009 Red Hat, Inc.\n"
" Copyright © 2008 Danilo Šegan\n"
" Copyright © 2012 Google, Inc.")])]
["gui"
""
"racket/gui"
""
#t
#f
(["libgtk-x11-2.0.0" "GTK+ is released under the GNU Library General Public License (GNU LGPL)."]
["libatk-1.0.0" "ATK is released under the GNU Library General Public License (GNU LGPL)."]
"libgdk-x11-2.0.0"
"libgdk_pixbuf-2.0.0")]
["db"
""
"db"
""
#t
"base"
(["libsqlite3.0" "SQLite3 is in the public domain."]
["sqlite3" "SQLite3 is in the public domain."])]
["poppler"
""
"racket-poppler"
""
#t
"racket-poppler"
(["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 4))
(define (libs-of-pkg p) (list-ref p 6))
(define (plain-path? p)
(equal? p "fonts"))
(define dest-dir
(build-command-line
@ -125,7 +210,7 @@
(error 'install "cannot find package for library: ~e" lib))
(apply values pkg))
(define (gen-info platform i-platform pkg pkg-name subdir libs lics lic-end)
(define (gen-info platform i-platform for-pkg pkg-name subdir libs lics lic-end lib?)
(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"))
@ -134,13 +219,23 @@
(newline o)
(pretty-write `(define install-platform ,i-platform) o)
(newline o)
(pretty-write `(define copy-foreign-libs (quote ,libs)) o))
(pretty-write `(define ,(if lib?
'copy-foreign-libs
'copy-shared-files)
(quote ,libs))
o)
(define dirs (filter (lambda (lib)
(directory-exists? (build-path dest subdir lib)))
libs))
(unless (null? dirs)
(newline o)
(pretty-write `(define compile-omit-paths (quote ,dirs)) o)))
(define (write-pkg o)
(newline o)
(pretty-write `(define collection 'multi) o)
(pretty-write `(define deps '("base")) o)
(newline o)
(pretty-write `(define pkg-desc ,(format "native libraries for \"~a\" package" pkg)) o)
(pretty-write `(define pkg-desc ,(format "native libraries for \"~a\" package" for-pkg)) o)
(newline o)
(pretty-write `(define pkg-authors '(mflatt)) o))
(unless same?
@ -187,16 +282,25 @@
(define pkgs-lic (make-hash))
(define (install lib)
(define p (format "~a.~a" lib so))
(define p (cond
[(plain-path? lib) lib]
[(procedure? so) (so lib)]
[else (format "~a.~a" lib so)]))
(define-values (pkg suffix subdir lic) (find-pkg lib))
(define dir (build-path dest-dir
(~a pkg "-" platform suffix)
subdir))
(define dest (build-path dir p))
(make-directory* dir)
(when (file-exists? dest) (delete-file dest))
(copy-file (build-path from p) dest)
(fixup p dest)
(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))
(hash-update! pkgs pkg (lambda (l) (cons p l)) '())
(when lic
@ -208,12 +312,13 @@
(define a (assoc pkg package-mapping))
(gen-info platform
i-platform
pkg
(~a pkg "-" platform (cadr a))
(caddr a)
(or (list-ref a 5) pkg)
(~a pkg "-" platform (list-ref a 1))
(list-ref a 2)
libs
(reverse (hash-ref pkgs-lic pkg null))
(list-ref a 3))))
(list-ref a 3)
(list-ref a 4))))
(define (install-mac)
(define (fixup p p-new)
@ -263,6 +368,39 @@
"-")
".")))))
(define (install-linux)
(define (fixup p p-new)
(printf "Fixing ~s\n" p-new)
(file-or-directory-permissions p-new #o755)
(unless (system (format "strip -S ~a" p-new))
(error "strip failed"))
;; Might fail if there are no external references:
(system (format "chrpath -r '$ORIGIN' ~a" p-new)))
(define platform (~a (if m32?
"i386"
"x86_64")
"-linux-natipkg"))
(define (add-so orig-p)
(let loop ([p orig-p] [suffix ""])
(define p-so (string-append p ".so" suffix))
(cond
[(file-exists? (build-path from p-so))
p-so]
[else
(define m (regexp-match #rx"^(.*)[.](.*)$" p))
(cond
[m
(loop (cadr m) (string-append "." (caddr m) suffix))]
[else
(error 'add-so "not found: ~s" orig-p)])])))
(install platform platform add-so fixup (append (remove* linux-remove-libs
libs)
linux-libs)))
(cond
[win? (install-win)]
[linux? (install-linux)]
[else (install-mac)])

View File

@ -0,0 +1,146 @@
diff -u -r old/fontconfig-2.11.1/fontconfig/fontconfig.h new/fontconfig-2.11.1/fontconfig/fontconfig.h
--- old/fontconfig-2.11.1/fontconfig/fontconfig.h 2014-10-07 06:54:53.000000000 -0600
+++ new/fontconfig-2.11.1/fontconfig/fontconfig.h 2014-10-07 17:44:20.000000000 -0600
@@ -342,6 +342,9 @@
FcCacheCreateTagFile (const FcConfig *config);
/* fccfg.c */
+FcPublic void
+FcSetConfigDir (const FcChar8 *config_dir);
+
FcPublic FcChar8 *
FcConfigHome (void);
@@ -582,6 +585,9 @@
FcPublic void
FcFini (void);
+FcPublic void
+FcSetFallbackDirs (const FcChar8 *font_dir, const FcChar8 *cache_dir);
+
FcPublic int
FcGetVersion (void);
Only in new/fontconfig-2.11.1/fontconfig: fontconfig.h~
diff -u -r old/fontconfig-2.11.1/src/fccfg.c new/fontconfig-2.11.1/src/fccfg.c
--- old/fontconfig-2.11.1/src/fccfg.c 2014-10-07 06:54:53.000000000 -0600
+++ new/fontconfig-2.11.1/src/fccfg.c 2014-10-07 17:44:11.000000000 -0600
@@ -1834,6 +1834,22 @@
#define FONTCONFIG_FILE "fonts.conf"
#endif
+static const FcChar8 * fc_config_dir = NULL;
+
+void
+FcSetConfigDir (const FcChar8 *config_dir)
+{
+ if (!fc_config_dir) {
+ fc_config_dir = (const FcChar8 *)strdup((const char *)config_dir);
+ }
+}
+
+FcChar8 *
+FcConfigDir (void)
+{
+ return fc_config_dir ? (FcChar8 *)fc_config_dir : (FcChar8 *)FONTCONFIG_PATH;
+}
+
static FcChar8 *
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
{
@@ -1935,7 +1951,7 @@
strcat ((char *) fontconfig_path, "\\fonts");
}
#endif
- dir = (FcChar8 *) FONTCONFIG_PATH;
+ dir = (fc_config_dir ? (FcChar8 *)fc_config_dir : (FcChar8 *)FONTCONFIG_PATH);
path[i] = malloc (strlen ((char *) dir) + 1);
if (!path[i])
goto bail1;
Only in new/fontconfig-2.11.1/src: fccfg.c~
diff -u -r old/fontconfig-2.11.1/src/fcinit.c new/fontconfig-2.11.1/src/fcinit.c
--- old/fontconfig-2.11.1/src/fcinit.c 2014-10-07 06:54:53.000000000 -0600
+++ new/fontconfig-2.11.1/src/fcinit.c 2014-10-07 17:43:44.000000000 -0600
@@ -35,6 +35,26 @@
#pragma message("To suppress these warnings, define FC_NO_MT.")
#endif
+static const FcChar8 * fc_default_fonts = NULL;
+static const FcChar8 * fc_cachedir = NULL;
+
+void
+FcSetFallbackDirs (const FcChar8 *font_dir, const FcChar8 *cache_dir)
+{
+ if (!fc_default_fonts) {
+ fc_default_fonts = (const FcChar8 *)strdup((const char *)font_dir);
+ fc_cachedir = (const FcChar8 *)strdup((const char *)cache_dir);
+ }
+}
+
+FcChar8 *
+FcFallbackCacheDir (void)
+{
+ return (fc_cachedir
+ ? fc_cachedir
+ : (const FcChar8 *)FC_CACHEDIR);
+}
+
static FcConfig *
FcInitFallbackConfig (void)
{
@@ -43,9 +63,13 @@
config = FcConfigCreate ();
if (!config)
goto bail0;
- if (!FcConfigAddDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
+ if (!FcConfigAddDir (config, (fc_default_fonts
+ ? fc_default_fonts
+ : (const FcChar8 *)FC_DEFAULT_FONTS)))
goto bail1;
- if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
+ if (!FcConfigAddCacheDir (config, (fc_cachedir
+ ? fc_cachedir
+ : (const FcChar8 *)FC_CACHEDIR)))
goto bail1;
return config;
Only in new/fontconfig-2.11.1/src: fcinit.c~
diff -u -r old/fontconfig-2.11.1/src/fcint.h new/fontconfig-2.11.1/src/fcint.h
--- old/fontconfig-2.11.1/src/fcint.h 2014-10-07 06:54:53.000000000 -0600
+++ new/fontconfig-2.11.1/src/fcint.h 2014-10-07 09:42:02.000000000 -0600
@@ -605,6 +605,9 @@
FcPrivate FcChar8 *
FcConfigXdgDataHome (void);
+FcPrivate FcChar8 *
+FcConfigDir (void);
+
FcPrivate FcExpr *
FcConfigAllocExpr (FcConfig *config);
@@ -806,6 +809,9 @@
FcPrivate void
FcDefaultFini (void);
+FcPrivate FcChar8 *
+FcFallbackCacheDir (void);
+
/* fcdir.c */
FcPrivate FcBool
Only in new/fontconfig-2.11.1/src: fcint.h~
diff -u -r old/fontconfig-2.11.1/src/fcxml.c new/fontconfig-2.11.1/src/fcxml.c
--- old/fontconfig-2.11.1/src/fcxml.c 2014-10-07 06:54:53.000000000 -0600
+++ new/fontconfig-2.11.1/src/fcxml.c 2014-10-07 09:42:42.000000000 -0600
@@ -1997,6 +1997,10 @@
attr = FcConfigGetAttribute (parse, "prefix");
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
prefix = FcConfigXdgDataHome ();
+ if (attr && FcStrCmp (attr, (const FcChar8 *)"cfg") == 0)
+ prefix = FcConfigDir ();
+ if (attr && FcStrCmp (attr, (const FcChar8 *)"cache") == 0)
+ prefix = FcFallbackCacheDir ();
data = FcStrBufDoneStatic (&parse->pstack->str);
if (!data)
{
Only in new/fontconfig-2.11.1/src: fcxml.c~

View File

@ -0,0 +1,111 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
This configuration is used for a -natipkg install to provide a minimal
set of fonts.
-->
<fontconfig>
<!-- Use config directory, as set via FcSetConfigDir(), for fonts -->
<dir prefix="cfg">.</dir>
<alias>
<family>serif</family>
<prefer>
<family>FreeSerif</family>
</prefer>
</alias>
<alias>
<family>sans</family>
<prefer>
<family>FreeSans</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>FreeMono</family>
</prefer>
</alias>
<!-- Use default cache dir set via FcSetFallbackDirs() -->
<cachedir prefix="cache">.</cachedir>
<config>
<!--
These are the default Unicode chars that are expected to be blank
in fonts. All other blank chars are assumed to be broken and
won't appear in the resulting charsets
-->
<blank>
<int>0x0020</int> <!-- SPACE -->
<int>0x00A0</int> <!-- NO-BREAK SPACE -->
<int>0x00AD</int> <!-- SOFT HYPHEN -->
<int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
<int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
<int>0x0601</int> <!-- ARABIC SIGN SANAH -->
<int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
<int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
<int>0x06DD</int> <!-- ARABIC END OF AYAH -->
<int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
<int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
<int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
<int>0x1680</int> <!-- OGHAM SPACE MARK -->
<int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
<int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
<int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
<int>0x2000</int> <!-- EN QUAD -->
<int>0x2001</int> <!-- EM QUAD -->
<int>0x2002</int> <!-- EN SPACE -->
<int>0x2003</int> <!-- EM SPACE -->
<int>0x2004</int> <!-- THREE-PER-EM SPACE -->
<int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
<int>0x2006</int> <!-- SIX-PER-EM SPACE -->
<int>0x2007</int> <!-- FIGURE SPACE -->
<int>0x2008</int> <!-- PUNCTUATION SPACE -->
<int>0x2009</int> <!-- THIN SPACE -->
<int>0x200A</int> <!-- HAIR SPACE -->
<int>0x200B</int> <!-- ZERO WIDTH SPACE -->
<int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
<int>0x200D</int> <!-- ZERO WIDTH JOINER -->
<int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
<int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
<int>0x2028</int> <!-- LINE SEPARATOR -->
<int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
<int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
<int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
<int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
<int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
<int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
<int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
<int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
<int>0x2060</int> <!-- WORD JOINER -->
<int>0x2061</int> <!-- FUNCTION APPLICATION -->
<int>0x2062</int> <!-- INVISIBLE TIMES -->
<int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
<int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
<int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
<int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
<int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
<int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
<int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
<int>0x2800</int> <!-- BRAILLE PATTERN BLANK -->
<int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
<int>0x3164</int> <!-- HANGUL FILLER -->
<int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
<int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
<int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
<int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
<int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
</blank>
<!--
Rescan configuration every 30 seconds when FcFontSetList is called
-->
<rescan>
<int>30</int>
</rescan>
</config>
</fontconfig>

View File

@ -48,6 +48,8 @@ AC_ARG_ENABLE(pkgscope,[ --enable-pkgscope=<s> set `raco pkg' default: instal
AC_ARG_ENABLE(docs, [ --enable-docs build docs on install (enabled by default)], , enable_docs=yes)
AC_ARG_ENABLE(usersetup, [ --enable-usersetup setup user-specific files on install])
AC_ARG_ENABLE(natipkg, [ --enable-natipkg add "-natipkg" to library subpath])
AC_ARG_ENABLE(shared, [ --enable-shared create shared libraries (ok, but not recommended)])
AC_ARG_ENABLE(dynlib, [ --enable-dynlib same as --enable-shared])
AC_ARG_ENABLE(lt, [ --enable-lt=<prog> use <prog> instead of libtool; disable to use bundled], LIBTOOLPROG="$enableval", enable_lt=default)
@ -276,6 +278,7 @@ show_explicitly_enabled "${enable_cgcdefault}" "CGC as default" "Note that this
show_explicitly_disabled "${enable_docs}" "Documentation build"
show_explicitly_enabled "${enable_usersetup}" "User-specific setup on install"
show_explicitly_enabled "${enable_natipkg}" "Adding \"-natipkg\" suffix to library subpath"
show_explicitly_enabled "${enable_xonx}" "Unix style"
show_explicitly_enabled "${enable_shared}" "Shared libraries"
@ -1463,6 +1466,12 @@ if test "${enable_docs}" = "no" ; then
INSTALL_SETUP_FLAGS="${INSTALL_SETUP_FLAGS} --no-docs"
fi
############## natipkg ################
if test "${enable_natipkg}" = "yes" ; then
AC_DEFINE(SPLS_SUFFIX,"-natipkg",[Library subpath suffix])
fi
############## Racket for Racket ################
if test "${enable_racket}" = "" ; then

View File

@ -92,4 +92,7 @@ typedef unsigned long uintptr_t;
/* To disable extflonums when they would otherwise work: */
#undef MZ_NO_EXTFLONUMS
/* Library subpath */
#undef SPLS_SUFFIX
#endif

View File

@ -56,6 +56,10 @@
# include "schsys.h"
#endif
#ifndef SPLS_SUFFIX
# define SPLS_SUFFIX ""
#endif
#include "schustr.inc"
#ifdef USE_ICONV_DLL
@ -420,8 +424,8 @@ scheme_init_string (Scheme_Env *env)
#endif
REGISTER_SO(platform_3m_path);
REGISTER_SO(platform_cgc_path);
platform_cgc_path = scheme_make_path(SCHEME_PLATFORM_LIBRARY_SUBPATH);
platform_3m_path = scheme_make_path(SCHEME_PLATFORM_LIBRARY_SUBPATH MZ3M_SUBDIR);
platform_cgc_path = scheme_make_path(SCHEME_PLATFORM_LIBRARY_SUBPATH SPLS_SUFFIX);
platform_3m_path = scheme_make_path(SCHEME_PLATFORM_LIBRARY_SUBPATH SPLS_SUFFIX MZ3M_SUBDIR);
REGISTER_SO(putenv_str_table);
@ -2796,7 +2800,7 @@ static Scheme_Object *system_library_subpath(int argc, Scheme_Object *argv[])
const char *scheme_system_library_subpath()
{
return SCHEME_PLATFORM_LIBRARY_SUBPATH;
return SCHEME_PLATFORM_LIBRARY_SUBPATH SPLS_SUFFIX;
}
/* Our own strncpy - which would be really stupid, except the one for