diff --git a/racket/collects/compiler/distribute.rkt b/racket/collects/compiler/distribute.rkt index 5a58aa6f3a..161386c4a5 100644 --- a/racket/collects/compiler/distribute.rkt +++ b/racket/collects/compiler/distribute.rkt @@ -109,12 +109,19 @@ ;; Copy libs into place (install-libs lib-dir types #:extras-only? (not executables?) - #:no-dlls? (and (eq? 'windows (cross-system-type)) - executables? - ;; If all executables have "" the the - ;; DLL dir, then no base DLLS are needed - (for/and ([f (in-list orig-binaries)]) - (current-no-dlls? f)))) + #:no-dlls? (and executables? + (case (cross-system-type) + [(windows) + ;; If all executables have "" the the + ;; DLL dir, then no base DLLS are needed + (for/and ([f (in-list orig-binaries)]) + (current-no-dlls? f))] + [(macosx) + ;; If no executable refers to a "Racket" + ;; framework, then they must embed it + (for/and ([f (in-list orig-binaries)]) + (not (get-current-framework-path (app-to-file f) "Racket")))] + [else #f]))) ;; Copy collections into place (unless (null? copy-collects) (make-directory* collects-dir)) (for-each (lambda (dir) @@ -179,7 +186,7 @@ (build-path lib-dir name)))]) (map copy-dll (get-racket-dlls types #:extras-only? extras-only?))))] [(macosx) - (unless extras-only? + (unless (or extras-only? no-dlls?) (when (or (memq 'racketcgc types) (memq 'gracketcgc types)) (copy-framework "Racket" 'cgc lib-dir)) @@ -686,6 +693,7 @@ (define (app-to-file b) (if (and (eq? 'macosx (cross-system-type)) + (directory-exists? b) (regexp-match #rx#"[.][aA][pP][pP]$" (path->bytes (if (string? b) (string->path b) diff --git a/racket/collects/compiler/embed.rkt b/racket/collects/compiler/embed.rkt index e941aed251..e17ca833a7 100644 --- a/racket/collects/compiler/embed.rkt +++ b/racket/collects/compiler/embed.rkt @@ -1537,7 +1537,8 @@ (raise x))]) (define old-perms (ensure-writable dest-exe)) (when (and (eq? 'macosx (cross-system-type)) - (not unix-starter?)) + (not unix-starter?) + (get-current-framework-path (mac-dest->executable dest mred?) "Racket")) (let ([m (or (assq 'framework-root aux) (and relative? '(framework-root . #f)))]) (if m diff --git a/racket/src/ac/make-configure b/racket/src/ac/make-configure index a007e17aa8..ecb3800ad6 100755 --- a/racket/src/ac/make-configure +++ b/racket/src/ac/make-configure @@ -5,9 +5,6 @@ src="../racket/configure.ac" tgt="../cfg-racket" if [ ! -e "$src" ]; then echo "abort: did not find $src"; exit 1; fi echo "Creating $tgt from $src" -if [ -e "$tgt" ]; then - /bin/echo -n "overwriting $tgt, Ctrl-C to abort, enter to continue "; read R; -fi autoconf "$src" | racket "$0" > "$tgt" chmod +x "$tgt" src="../rktio/configure.ac" diff --git a/racket/src/ac/sdk.m4 b/racket/src/ac/sdk.m4 index 533398c238..9bcdd14c5c 100644 --- a/racket/src/ac/sdk.m4 +++ b/racket/src/ac/sdk.m4 @@ -23,3 +23,12 @@ else ;; esac fi + + +MACLIBRKT_LINK_MODE=fw + +if test "${enable_embedfw}" = "yes" ; then + MACLIBRKT_LINK_MODE=static +fi + +AC_SUBST(MACLIBRKT_LINK_MODE) diff --git a/racket/src/ac/sdk_arg.m4 b/racket/src/ac/sdk_arg.m4 index 7ffb36d5fe..0317af700c 100644 --- a/racket/src/ac/sdk_arg.m4 +++ b/racket/src/ac/sdk_arg.m4 @@ -8,4 +8,5 @@ AC_ARG_ENABLE(xonx, [ --enable-xonx use Unix style (e.g., use Gtk) AC_ARG_ENABLE(macprefix, [ --enable-macprefix allow --prefix with a Mac OS install]) AC_ARG_ENABLE(libfw, [ --enable-libfw install Mac OS frameworks to /Library/Frameworks]) AC_ARG_ENABLE(userfw, [ --enable-userfw install Mac OS frameworks to ~/Library/Frameworks]) +AC_ARG_ENABLE(embedfw, [ --enable-embedfw embed Mac OS framework content in executables]) AC_ARG_ENABLE(mac64, [ --enable-mac64 allow 64-bit Mac OS build (enabled by default)], , enable_mac64=yes) diff --git a/racket/src/cfg-cs b/racket/src/cfg-cs index a54d9627c9..14f12cebfb 100755 --- a/racket/src/cfg-cs +++ b/racket/src/cfg-cs @@ -616,6 +616,7 @@ appsdir collectsdir MAKE_INSTALL_PKGSCOPE INSTALL_PKGSCOPE +MACLIBRKT_LINK_MODE target_os target_vendor target_cpu @@ -679,6 +680,7 @@ enable_xonx enable_macprefix enable_libfw enable_userfw +enable_embedfw enable_mac64 ' ac_precious_vars='build_alias @@ -1302,6 +1304,7 @@ Optional Features: --enable-macprefix allow --prefix with a Mac OS install --enable-libfw install Mac OS frameworks to /Library/Frameworks --enable-userfw install Mac OS frameworks to ~/Library/Frameworks + --enable-embedfw embed Mac OS framework content in executables --enable-mac64 allow 64-bit Mac OS build (enabled by default) Report bugs to the package provider. @@ -1957,6 +1960,11 @@ if test "${enable_userfw+set}" = set; then : enableval=$enable_userfw; fi +# Check whether --enable-embedfw was given. +if test "${enable_embedfw+set}" = set; then : + enableval=$enable_embedfw; +fi + # Check whether --enable-mac64 was given. if test "${enable_mac64+set}" = set; then : enableval=$enable_mac64; @@ -1993,6 +2001,15 @@ else fi +MACLIBRKT_LINK_MODE=fw + +if test "${enable_embedfw}" = "yes" ; then + MACLIBRKT_LINK_MODE=static +fi + + + + INSTALL_PKGSCOPE=user MAKE_INSTALL_PKGSCOPE=preserve if test "${enable_pkgscope}" != "" ; then diff --git a/racket/src/cfg-racket b/racket/src/cfg-racket index 091f6425d4..f7d0283dd9 100755 --- a/racket/src/cfg-racket +++ b/racket/src/cfg-racket @@ -747,6 +747,7 @@ libpltdir_rel libpltdir appsdir collectsdir +MACLIBRKT_LINK_MODE target_os target_vendor target_cpu @@ -825,6 +826,7 @@ enable_xonx enable_macprefix enable_libfw enable_userfw +enable_embedfw enable_mac64 enable_csdefault enable_cgcdefault @@ -1487,6 +1489,7 @@ Optional Features: --enable-macprefix allow --prefix with a Mac OS install --enable-libfw install Mac OS frameworks to /Library/Frameworks --enable-userfw install Mac OS frameworks to ~/Library/Frameworks + --enable-embedfw embed Mac OS framework content in executables --enable-mac64 allow 64-bit Mac OS build (enabled by default) --enable-csdefault use CS as default build --enable-cgcdefault use CGC as default build (NOT RECOMMENDED) @@ -2787,6 +2790,11 @@ if test "${enable_userfw+set}" = set; then : enableval=$enable_userfw; fi +# Check whether --enable-embedfw was given. +if test "${enable_embedfw+set}" = set; then : + enableval=$enable_embedfw; +fi + # Check whether --enable-mac64 was given. if test "${enable_mac64+set}" = set; then : enableval=$enable_mac64; @@ -2985,6 +2993,15 @@ else fi +MACLIBRKT_LINK_MODE=fw + +if test "${enable_embedfw}" = "yes" ; then + MACLIBRKT_LINK_MODE=static +fi + + + + if test "${enable_iconv}" = "" ; then enable_iconv=yes fi diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in index f11de0cd19..bfaef7a07a 100644 --- a/racket/src/cs/c/Makefile.in +++ b/racket/src/cs/c/Makefile.in @@ -31,6 +31,8 @@ RACKET = @RACKET@ CS_INSTALLED = @CS_INSTALLED@ +NOOP = : + prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ @@ -240,8 +242,13 @@ RKTFWDIR = Racket.framework/Versions/$(FWVERSION)_CS RKTFW = $(RKTFWDIR)/Racket GRAPPSKEL = GRacketCS.app/Contents/Info.plist +# Depending on MACLIBRKT_LINK_MODE, use Framework or statically link the framework's code: +MACLIBRKT_LINK_fw = -F. -framework Racket $(LDFLAGS) +MACLIBRKT_LINK_static = $(BOOT_OBJS) $(LDFLAGS) $(LIBS) + racketcs@OSX@: main.o $(RKTFW) - $(CC) $(CFLAGS) -o racketcs main.o -F. -framework Racket $(LDFLAGS) + $(CC) $(CFLAGS) -o racketcs main.o $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) + $(MAKE) mac-embed-boot-@MACLIBRKT_LINK_MODE@ EMBED_DEST=racketcs /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)_CS/Racket" "@executable_path/Racket.framework/Versions/$(FWVERSION)_CS/Racket" racketcs GRACKET_BIN = GRacketCS.app/Contents/MacOS/GRacketCS @@ -250,7 +257,8 @@ gracketcs@OSX@: $(MAKE) $(GRACKET_BIN) $(GRACKET_BIN): grmain.o $(RKTFW) $(GRAPPSKEL) - $(CC) $(CFLAGS) -o $(GRACKET_BIN) grmain.o -F. -framework Racket $(LDFLAGS) + $(CC) $(CFLAGS) -o $(GRACKET_BIN) grmain.o $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) + $(MAKE) mac-embed-boot-@MACLIBRKT_LINK_MODE@ EMBED_DEST=$(GRACKET_BIN) /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)_CS/Racket" "@executable_path/../../../Racket.framework/Versions/$(FWVERSION)_CS/Racket" $(GRACKET_BIN) $(GRAPPSKEL): $(srcdir)/../../mac/osx_appl.rkt $(srcdir)/../../racket/src/schvers.h $(srcdir)/../../mac/icon/GRacket.icns @@ -270,6 +278,12 @@ $(RKTFW): $(BOOT_OBJ_DEPS) $(BOOT_FILES) $(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ racket.boot $(FW_BOOT_DEST)/racket.boot petite scheme $(BOOTSTRAP_RACKET) $(srcdir)/adjust-compress.rkt @BOOT_COMPRESS_COMP@ $(FW_BOOT_DEST)/petite.boot $(FW_BOOT_DEST)/scheme.boot $(FW_BOOT_DEST)/racket.boot +mac-embed-boot-fw: + $(NOOP) + +mac-embed-boot-static: + $(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @BOOT_COMPRESS_COMP@ "" $(EMBED_DEST) $(FW_BOOT_DEST)/petite.boot $(FW_BOOT_DEST)/scheme.boot $(FW_BOOT_DEST)/racket.boot + # ---------------------------------------- # MinGW diff --git a/racket/src/cs/c/boot.c b/racket/src/cs/c/boot.c index d7131e94ab..d0364d8800 100644 --- a/racket/src/cs/c/boot.c +++ b/racket/src/cs/c/boot.c @@ -138,16 +138,14 @@ static void init_foreign() void racket_boot(int argc, char **argv, char *exec_file, char *run_file, char *boot_exe, long segment_offset, char *coldir, char *configdir, /* wchar_t * */void *dlldir, - int pos1, int pos2, int pos3, + int is_embedded, int pos1, int pos2, int pos3, int cs_compiled_subdir, int is_gui, int wm_is_gracket_or_x11_arg_count, char *gracket_guid_or_x11_args, void *dll_open, void *dll_find_object, void *dll_close) /* exe argument already stripped from argv */ { -#if !defined(RACKET_USE_FRAMEWORK) || !defined(RACKET_AS_BOOT) int fd; -#endif #ifdef RACKET_AS_BOOT int skip_racket_boot = 0; #endif @@ -173,37 +171,41 @@ void racket_boot(int argc, char **argv, char *exec_file, char *run_file, } #ifdef RACKET_USE_FRAMEWORK - fw_path = get_framework_path(); - Sregister_boot_file(path_append(fw_path, "petite.boot")); - Sregister_boot_file(path_append(fw_path, "scheme.boot")); + if (!is_embedded) { + fw_path = get_framework_path(); + Sregister_boot_file(path_append(fw_path, "petite.boot")); + Sregister_boot_file(path_append(fw_path, "scheme.boot")); # ifdef RACKET_AS_BOOT - if (!skip_racket_boot) - Sregister_boot_file(path_append(fw_path, "racket.boot")); -# endif -#else - fd = open(boot_exe, O_RDONLY | BOOT_O_BINARY); - - { - int fd1, fd2; - - fd1 = dup(fd); - lseek(fd1, pos1, SEEK_SET); - Sregister_boot_file_fd("petite", fd1); - - fd2 = open(boot_exe, O_RDONLY | BOOT_O_BINARY); - lseek(fd2, pos2, SEEK_SET); - Sregister_boot_file_fd("scheme", fd2); - -# ifdef RACKET_AS_BOOT - if (!skip_racket_boot) { - fd = open(boot_exe, O_RDONLY | BOOT_O_BINARY); - lseek(fd, pos3, SEEK_SET); - Sregister_boot_file_fd("racket", fd); - } + if (!skip_racket_boot) + Sregister_boot_file(path_append(fw_path, "racket.boot")); # endif } #endif + if (is_embedded) { + fd = open(boot_exe, O_RDONLY | BOOT_O_BINARY); + + { + int fd1, fd2; + + fd1 = dup(fd); + lseek(fd1, pos1, SEEK_SET); + Sregister_boot_file_fd("petite", fd1); + + fd2 = open(boot_exe, O_RDONLY | BOOT_O_BINARY); + lseek(fd2, pos2, SEEK_SET); + Sregister_boot_file_fd("scheme", fd2); + +# ifdef RACKET_AS_BOOT + if (!skip_racket_boot) { + fd = open(boot_exe, O_RDONLY | BOOT_O_BINARY); + lseek(fd, pos3, SEEK_SET); + Sregister_boot_file_fd("racket", fd); + } +# endif + } + } + Sbuild_heap(NULL, init_foreign); if (cross_server) { @@ -248,8 +250,10 @@ void racket_boot(int argc, char **argv, char *exec_file, char *run_file, #ifndef RACKET_AS_BOOT # ifdef RACKET_USE_FRAMEWORK - fd = open(path_append(fw_path, "racket.so"), O_RDONLY); - pos3 = 0; + if (!is_embedded) { + fd = open(path_append(fw_path, "racket.so"), O_RDONLY); + pos3 = 0; + } # endif { diff --git a/racket/src/cs/c/boot.h b/racket/src/cs/c/boot.h index 7b87b7d321..84017e5987 100644 --- a/racket/src/cs/c/boot.h +++ b/racket/src/cs/c/boot.h @@ -1,7 +1,7 @@ BOOT_EXTERN void racket_boot(int argc, char **argv, char *exec_file, char *run_file, char *boot_exe, long segment_offset, char *coldir, char *configdir, /* wchar_t * */void *dlldir, - int pos1, int pos2, int pos3, + int is_embedded, int pos1, int pos2, int pos3, int cs_compiled_subdir, int is_gui, int wm_is_gracket_or_x11_arg_count, char *gracket_guid_or_x11_args, void *ddll_open, void *dll_find_object, void *dll_close); @@ -9,7 +9,7 @@ BOOT_EXTERN void racket_boot(int argc, char **argv, char *exec_file, char *run_f typedef void (*racket_boot_t)(int argc, char **argv, char *exec_file, char *run_file, char* boot_exe, long segment_offset, char *coldir, char *configdir, /* wchar_t * */void *dlldir, - int pos1, int pos2, int pos3, + int is_embedded, int pos1, int pos2, int pos3, int cs_compiled_subdir, int is_gui, int wm_is_gracket_or_x11_arg_count, char *gracket_guid_or_x11_args, void *ddll_open, void *dll_find_object, void *dll_close); diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure index 8a61ba2964..fc44f307c4 100755 --- a/racket/src/cs/c/configure +++ b/racket/src/cs/c/configure @@ -712,6 +712,7 @@ appsdir collectsdir MAKE_INSTALL_PKGSCOPE INSTALL_PKGSCOPE +MACLIBRKT_LINK_MODE target_os target_vendor target_cpu @@ -786,6 +787,7 @@ enable_xonx enable_macprefix enable_libfw enable_userfw +enable_embedfw enable_mac64 enable_noopt enable_ubsan @@ -1434,6 +1436,7 @@ Optional Features: --enable-macprefix allow --prefix with a Mac OS install --enable-libfw install Mac OS frameworks to /Library/Frameworks --enable-userfw install Mac OS frameworks to ~/Library/Frameworks + --enable-embedfw embed Mac OS framework content in executables --enable-mac64 allow 64-bit Mac OS build (enabled by default) --enable-strip strip debug on install (usually enabled by default) --enable-ubsan compile with -fsanitize=undefined @@ -2632,6 +2635,11 @@ if test "${enable_userfw+set}" = set; then : enableval=$enable_userfw; fi +# Check whether --enable-embedfw was given. +if test "${enable_embedfw+set}" = set; then : + enableval=$enable_embedfw; +fi + # Check whether --enable-mac64 was given. if test "${enable_mac64+set}" = set; then : enableval=$enable_mac64; @@ -2717,6 +2725,15 @@ else fi +MACLIBRKT_LINK_MODE=fw + +if test "${enable_embedfw}" = "yes" ; then + MACLIBRKT_LINK_MODE=static +fi + + + + show_explicitly_disabled() { if test "$1" = "no" ; then diff --git a/racket/src/cs/c/embed-boot.rkt b/racket/src/cs/c/embed-boot.rkt index d7b867a767..ba52405558 100644 --- a/racket/src/cs/c/embed-boot.rkt +++ b/racket/src/cs/c/embed-boot.rkt @@ -23,11 +23,24 @@ (set! alt-dests (cons (cons src dest) alt-dests))] #:args (src-file dest-file petite.boot scheme.boot racket.boot) + ;; If `src-file` is "", then `dest-file` is used as the src, too + (define bstr1 (adjust-compress (file->bytes petite.boot))) (define bstr2 (adjust-compress (file->bytes scheme.boot))) (define bstr3 (adjust-compress (file->bytes racket.boot))) + (define use-src-file + (if (equal? src-file "") + (let ([src-file (path-add-suffix dest-file #"_tmp")]) + (rename-file-or-directory dest-file src-file) + src-file) + src-file)) + (define (clean-src) + (unless (eq? use-src-file src-file) + (delete-file use-src-file))) + (with-handlers ([exn? (lambda (x) + (clean-src) (when (file-exists? dest-file) (delete-file dest-file)) (raise x))]) @@ -45,10 +58,12 @@ (case (or target (path->string (system-library-subpath #f))) [("x86_64-darwin" "i386-darwin" "x86_64-macosx" "i386-macosx") ;; Mach-O - (copy-file src-file dest-file #t) - (add-plt-segment dest-file data #:name #"__RKTBOOT")] + (copy-file use-src-file dest-file #t) + (add-plt-segment dest-file data #:name #"__RKTBOOT") + ;; Find segment at run time: + 0] [("ta6nt" "ti3nt" "win32\\x86_64" "win32\\i386") - (copy-file src-file dest-file #t) + (copy-file use-src-file dest-file #t) (define-values (pe rsrcs) (call-with-input-file* dest-file read-pe+resources)) @@ -64,7 +79,7 @@ [else ;; ELF? (define-values (start-pos end-pos any1 any2) - (add-racket-section src-file dest-file #".rackboot" + (add-racket-section use-src-file dest-file #".rackboot" (lambda (pos) (values data 'any1 'any2)))) (define (ensure-executable dest-file) @@ -85,7 +100,7 @@ start-pos])] [else ;; Not ELF; just append to the end - (copy-file src-file dest-file #t) + (copy-file use-src-file dest-file #t) (ensure-executable dest-file) (define pos (file-size dest-file)) (call-with-output-file* @@ -117,6 +132,6 @@ [else (for ([alt (in-list alt-dests)]) (copy-file (car alt) (cdr alt) #t) - (write-offsets (cdr alt)))]))) - - + (write-offsets (cdr alt)))]) + + (clean-src))) diff --git a/racket/src/cs/c/main.c b/racket/src/cs/c/main.c index 39725f2b46..ce2566fcea 100644 --- a/racket/src/cs/c/main.c +++ b/racket/src/cs/c/main.c @@ -79,6 +79,32 @@ static char *get_self_path(char *exec_file) } } # undef USE_GENERIC_GET_SELF_PATH + +static long find_rktboot_section(char *me) +{ + const struct mach_header *mh; + const struct load_command *lc; + int i; + + mh = _dyld_get_image_header(0); + + lc = (void *)((char *)mh + ((mh->magic == 0xfeedfacf) ? sizeof(struct mach_header_64) : sizeof(struct mach_header))); + + for (i = 0; i < mh->ncmds; i++) { + if (lc->cmd == LC_SEGMENT) { + const struct segment_command *sc = (struct segment_command *)lc; + if (!strcmp(sc->segname, "__RKTBOOT")) + return sc->fileoff; + } else if (lc->cmd == LC_SEGMENT_64) { + const struct segment_command_64 *sc = (struct segment_command_64 *)lc; + if (!strcmp(sc->segname, "__RKTBOOT")) + return sc->fileoff; + } + lc = (void *)((char *)lc + lc->cmdsize); + } + + return 0; +} #endif #if defined(__linux__) @@ -350,7 +376,7 @@ static int bytes_main(int argc, char **argv, int wm_is_gracket_or_x11_arg_count, char *gracket_guid_or_x11_args) { char *boot_exe, *exec_file = argv[0], *run_file = NULL; - int pos1, pos2, pos3; + int is_embedded = 1, pos1, pos2, pos3; long boot_offset; long segment_offset; #ifdef WIN32 @@ -398,6 +424,9 @@ static int bytes_main(int argc, char **argv, #ifdef ELF_FIND_BOOT_SECTION boot_offset = find_boot_section(boot_exe); +#elif OS_X + boot_offset = find_rktboot_section(boot_exe); + if (!boot_offset) is_embedded = 0; #elif WIN32 boot_offset = find_resource_offset(dll_path, 259, boot_rsrc_offset); #else @@ -411,7 +440,7 @@ static int bytes_main(int argc, char **argv, racket_boot(argc, argv, exec_file, run_file, boot_exe, segment_offset, extract_coldir(), extract_configdir(), extract_dlldir(), - pos1, pos2, pos3, + is_embedded, pos1, pos2, pos3, CS_COMPILED_SUBDIR, RACKET_IS_GUI, wm_is_gracket_or_x11_arg_count, gracket_guid_or_x11_args, embedded_dll_open, scheme_dll_find_object, embedded_dll_close); diff --git a/racket/src/gracket/Makefile.in b/racket/src/gracket/Makefile.in index 23e4c64cba..9728c6d5bc 100644 --- a/racket/src/gracket/Makefile.in +++ b/racket/src/gracket/Makefile.in @@ -124,8 +124,12 @@ resources@MINGW@ : gres.o MRFW = Racket.framework/Versions/$(FWVERSION)/Racket MRAPPSKEL = GRacket@CGC@.app/Contents/Info.plist +# Depending on MACLIBRKT_LINK_MODE, use Framework or statically link the framework's code: +MACLIBRKT_LINK_fw = -F../racket -framework Racket +MACLIBRKT_LINK_static = ../racket/libracket.@LIBSFX@ ../racket/libmzgc.@LIBSFX@ $(LIBRKTIO) $(LDLIBS) + GRacket@CGC@.app/Contents/MacOS/GRacket@CGC@: $(MZFW) $(MRAPPSKEL) grmain.@LTO@ - $(GRACKETLINKER) $(GRACKETLDFLAGS) -o GRacket@CGC@.app/Contents/MacOS/GRacket@CGC@ grmain.@LTO@ -Wl,-headerpad_max_install_names -F../racket -framework Racket -framework CoreFoundation @PROFFLAGS@ + $(GRACKETLINKER) $(GRACKETLDFLAGS) -o GRacket@CGC@.app/Contents/MacOS/GRacket@CGC@ grmain.@LTO@ -Wl,-headerpad_max_install_names $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) -framework CoreFoundation @PROFFLAGS@ /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)/Racket" "@executable_path/../../../../racket/Racket.framework/Versions/$(FWVERSION)/Racket" GRacket@CGC@.app/Contents/MacOS/GRacket@CGC@ $(MRAPPSKEL): $(srcdir)/../mac/osx_appl.rkt $(srcdir)/../racket/src/schvers.h $(srcdir)/../mac/icon/GRacket.icns diff --git a/racket/src/gracket/gc2/Makefile.in b/racket/src/gracket/gc2/Makefile.in index 0b04e820f2..3eb2888005 100644 --- a/racket/src/gracket/gc2/Makefile.in +++ b/racket/src/gracket/gc2/Makefile.in @@ -112,8 +112,12 @@ GRACKETMZOBJS_la = MZFW = ../../racket/Racket.framework/Versions/$(FWVERSION)_3m/Racket MRAPPSKEL = ../GRacket@MMM@.app/Contents/Info.plist +# Depending on MACLIBRKT_LINK_MODE, use Framework or statically link the framework's code: +MACLIBRKT_LINK_fw = -F../../racket/gc2 -framework Racket +MACLIBRKT_LINK_static = ../../racket/libracket3m.@LIBSFX@ $(LIBRKTIO) $(LDLIBS) + ../GRacket@MMM@.app/Contents/MacOS/GRacket@MMM@: $(MRAPPSKEL) $(MZFW) grmain.@LTO@ - $(GRACKETLINKER) $(LDFLAGS) -o ../GRacket@MMM@.app/Contents/MacOS/GRacket@MMM@ grmain.@LTO@ -Wl,-headerpad_max_install_names -F../../racket/gc2 -framework Racket -framework CoreFoundation + $(GRACKETLINKER) $(LDFLAGS) -o ../GRacket@MMM@.app/Contents/MacOS/GRacket@MMM@ grmain.@LTO@ -Wl,-headerpad_max_install_names $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) -framework CoreFoundation /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)_3m/Racket" "@executable_path/../../../../racket/Racket.framework/Versions/$(FWVERSION)_3m/Racket" "../GRacket@MMM@.app/Contents/MacOS/GRacket@MMM@" $(MRFW) : $(XOBJS) $(@WXVARIANT@_PLAIN_OBJS) ../../racket/libracket3m.@LIBSFX@ wx_font.o wx_file_dialog.o $(MRFWRES) diff --git a/racket/src/racket/Makefile.in b/racket/src/racket/Makefile.in index b4a01d9bf6..26f6811baa 100644 --- a/racket/src/racket/Makefile.in +++ b/racket/src/racket/Makefile.in @@ -212,14 +212,20 @@ mzcom@CGC@@NOT_MINGW@: MZFW = Racket.framework/Versions/$(FWVERSION)/Racket +MACLIBRKT_LIBS = $(SPECIALIZINGOBJECTS) libracket.@LIBSFX@ libmzgc.@LIBSFX@ $(LIBRKTIO) -framework CoreFoundation + $(MZFW): libracket.@LIBSFX@ libmzgc.@LIBSFX@ $(SPECIALIZINGOBJECTS) $(LIBRKTIO) mkdir -p Racket.framework/Versions/$(FWVERSION) - @MZLINKER@ -o $(MZFW) @LDFLAGS@ -framework CoreFoundation -dynamiclib -all_load $(SPECIALIZINGOBJECTS) libracket.@LIBSFX@ libmzgc.@LIBSFX@ $(LIBRKTIO) @LIBS@ + @MZLINKER@ -o $(MZFW) @LDFLAGS@ -dynamiclib -all_load $(MACLIBRKT_LIBS) @LIBS@ rm -f Racket.framework/Racket ln -s Versions/$(FWVERSION)/Racket Racket.framework/Racket +# Depending on MACLIBRKT_LINK_MODE, use Framework or statically link the framework's code: +MACLIBRKT_LINK_fw = -F. -framework Racket +MACLIBRKT_LINK_static = $(MACLIBRKT_LIBS) + racket@CGC@@OSX@: $(MZFW) main.@LTO@ - @MZLINKER@ -o racket@CGC@ @PROFFLAGS@ @LDFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names -F. -framework Racket @LIBS@ + @MZLINKER@ -o racket@CGC@ @PROFFLAGS@ @LDFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) @LIBS@ /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)/Racket" "@executable_path/Racket.framework/Versions/$(FWVERSION)/Racket" "racket@CGC@" # mingw ---------------------------------------- diff --git a/racket/src/racket/gc2/Makefile.in b/racket/src/racket/gc2/Makefile.in index 92819765e0..ef33c5881e 100644 --- a/racket/src/racket/gc2/Makefile.in +++ b/racket/src/racket/gc2/Makefile.in @@ -600,16 +600,22 @@ EXTRA_OBJS_L = $(EXTRA_GMP) ../src/unwind.@LTO@ $(@FOREIGN_IF_USED@_OBJSLIB) $(L MZFWMMM = Racket.framework/Versions/$(FWVERSION)_3m/Racket +MACLIBRKT_LIBS = ../libracket3m.@LIBSFX@ $(LIBRKTIO) -framework CoreFoundation + $(MZFWMMM): ../libracket3m.@LIBSFX@ $(LIBRKTIO) mkdir -p "Racket.framework/Versions/$(FWVERSION)_3m" - @MZLINKER@ -o $(MZFWMMM) -framework CoreFoundation -dynamiclib -all_load ../libracket3m.@LIBSFX@ $(LIBRKTIO) @LDFLAGS@ $(LIBS) + @MZLINKER@ -o $(MZFWMMM) -dynamiclib -all_load $(MACLIBRKT_LIBS) @LDFLAGS@ $(LIBS) rm -f Racket.framework/Racket ln -s Versions/$(FWVERSION)_3m/Racket Racket.framework/Racket - -../racket@MMM@@OSX@: $(MZFWMMM) main.@LTO@ - @MZLINKER@ -o ../racket@MMM@ @PROFFLAGS@ @LDFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names -F. -framework Racket @LIBS@ mkdir -p "../Racket.framework/Versions/$(FWVERSION)_3m" cp "Racket.framework/Versions/$(FWVERSION)_3m/Racket" "../Racket.framework/Versions/$(FWVERSION)_3m/Racket" + +# Depending on MACLIBRKT_LINK_MODE, use Framework or statically link the framework's code: +MACLIBRKT_LINK_fw = -F. -framework Racket +MACLIBRKT_LINK_static = $(MACLIBRKT_LIBS) + +../racket@MMM@@OSX@: $(MZFWMMM) main.@LTO@ + @MZLINKER@ -o ../racket@MMM@ @PROFFLAGS@ @LDFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names $(MACLIBRKT_LINK_@MACLIBRKT_LINK_MODE@) @LIBS@ /usr/bin/install_name_tool -change "Racket.framework/Versions/$(FWVERSION)_3m/Racket" "@executable_path/Racket.framework/Versions/$(FWVERSION)_3m/Racket" "../racket@MMM@" ../lib/libracket3mxxxxxxx.dll: ../libracket3m.@LIBSFX@ ../mzsj86g.o $(LIBRKTIO)