From 1a9122ab2657d862a2bd937ec77ec3fff5dd2911 Mon Sep 17 00:00:00 2001 From: Gabor de Mooij Date: Sat, 25 Jan 2025 18:17:20 +0100 Subject: [PATCH] Merge with mac-branch. --- makefile.mac | 12 +++-- misc/distrib_osx.sh | 53 ++++++++++++++++--- .../assets/Citrine.app/Contents/Info.plist | 26 +++++++++ plugins/media/makefile.mac | 12 ++--- 4 files changed, 87 insertions(+), 16 deletions(-) mode change 100644 => 100755 misc/distrib_osx.sh create mode 100644 misc/export/assets/Citrine.app/Contents/Info.plist diff --git a/makefile.mac b/makefile.mac index 882f3894..54341a39 100644 --- a/makefile.mac +++ b/makefile.mac @@ -1,7 +1,8 @@ CFLAGS = -O2 -std=c99 -mtune=native -Wall -D CTRLANG=${ISO} -D PATH_MAX=1024 \ -D REPLACE_PLUGIN_SYSTEM -D MACOS_PLUGIN_SYSTEM -OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \ - world.o lexer.o parser.o walker.o translator.o citrine.o portability.o +OBJS = ${EMBED} test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \ + world.o lexer.o parser.o walker.o translator.o citrine.o portability.o + .SUFFIXES: .o .c @@ -11,13 +12,16 @@ install: ctr cp ./ctr /usr/bin/ctr ctr: $(OBJS) - $(CC) $(OBJS) -rdynamic -undefined dynamic_lookup -lm -o bin/Mac/ctr${ISO} + $(CC) $(OBJS) -rdynamic -undefined dynamic_lookup ${LDFLAGS} -lm -o bin/Mac/ctr${ISO} .c.o: $(CC) $(CFLAGS) $(EXTRACFLAGS) -I i18n/${ISO} -c $< + clean: rm -rf ${OBJS} ctr plugin: - cd plugins/${PACKAGE} ; make -f makefile.mac clean ; make -f makefile.mac install-${NAME} \ No newline at end of file + cd plugins/${PACKAGE} ; make -f makefile.mac clean ; make -f makefile.mac install-${NAME} + + diff --git a/misc/distrib_osx.sh b/misc/distrib_osx.sh old mode 100644 new mode 100755 index 2bdc2981..c73c8ee5 --- a/misc/distrib_osx.sh +++ b/misc/distrib_osx.sh @@ -1,4 +1,6 @@ - + +VERSION="1_0_0" #for files +VERSION_NAME="1.0.0" #for display cd .. @@ -6,17 +8,56 @@ rm -rf dist/osx mkdir dist/osx rm bin/Mac/* -declare -a langs=("nl" "en") + +declare -a langs=("en" "nl") for lang in "${langs[@]}" do -mkdir -p dist/osx/$lang/mods/media -cp tpl/$lang/* dist/osx/$lang/ rm mods/media/libctrmedia.dylib ISO="$lang" make -f makefile.mac clean ISO="$lang" OS="Mac" make -f makefile.mac ISO="$lang" PACKAGE="media" NAME="libctrmedia.dylib" make -f makefile.mac plugin -mv ./bin/Mac/ctr$lang dist/osx/$lang/ctr$lang -mv ./mods/media/libctrmedia.dylib dist/osx/$lang/mods/media/ + +# Create dictionary +./bin/Mac/ctren -g i18n/en/dictionary.h i18n/$lang/dictionary.h > /tmp/dict_general.dict +./bin/Mac/ctren -g plugins/media/i18n/en/media.h plugins/media/i18n/$lang/media.h > /tmp/dict_media.dict +cat /tmp/dict_general.dict /tmp/dict_media.dict plugins/media/i18n/$lang/extra.dict > /tmp/dict_all.dict + +# (Re-)Create folder for lang specific distribution + +mkdir -p dist/osx/ISO/$lang +mkdir -p dist/osx/OUT/$lang + +mkdir dist/osx/ISO/$lang/mods +mkdir dist/osx/ISO/$lang/mods/media + +# Add executable +cp ./bin/Mac/ctr$lang dist/osx/ISO/$lang/ctr$lang +# Add dynamic libraries +cp ./mods/media/libctrmedia.dylib dist/osx/ISO/$lang/mods/media/ + +# Add assets +cp demodata dist/osx/ISO/$lang/ + +# Translate examples +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo1.ctr > dist/osx/ISO/$lang/demo1.ctr 2>/tmp/err1.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo2.ctr > dist/osx/ISO/$lang/demo2.ctr 2>/tmp/err2.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo3.ctr > dist/osx/ISO/$lang/demo3.ctr 2>/tmp/err3.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo4.ctr > dist/osx/ISO/$lang/demo4.ctr 2>/tmp/err4.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo5.ctr > dist/osx/ISO/$lang/demo5.ctr 2>/tmp/err5.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo6.ctr > dist/osx/ISO/$lang/demo6.ctr 2>/tmp/err6.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo7.ctr > dist/osx/ISO/$lang/demo7.ctr 2>/tmp/err7.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo8.ctr > dist/osx/ISO/$lang/demo8.ctr 2>/tmp/err8.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo9.ctr > dist/osx/ISO/$lang/demo9.ctr 2>/tmp/err9.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo10.ctr > dist/osx/ISO/$lang/demo10.ctr 2>/tmp/err10.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo11.ctr > dist/osx/ISO/$lang/demo11.ctr 2>/tmp/err11.log +./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/pak-o-mat.ctr > dist/osx/ISO/$lang/pak-o-mat.ctr 2>/tmp/pak-o-mat.log + +rm -rf /tmp/dist$lang +cp -R dist/osx/ISO/$lang /tmp/dist$lang +cp -R ~/frameworks/* /tmp/dist$lang # put SDL2 frameworks for macos here to craft dist +#cp -R ~/libs/* /tmp/dist$lang # other libs + +hdiutil create -volname ctr${lang}${VERSION} -srcfolder /tmp/dist$lang -ov -format UDZO dist/osx/OUT/$lang/ctr${lang}${VERSION}.dmg done diff --git a/misc/export/assets/Citrine.app/Contents/Info.plist b/misc/export/assets/Citrine.app/Contents/Info.plist new file mode 100644 index 00000000..73062ac2 --- /dev/null +++ b/misc/export/assets/Citrine.app/Contents/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleGetInfoString + Citrine + CFBundleExecutable + {CTRVERSION} + CFBundleIdentifier + nl.gaborsoftware.www + CFBundleName + Citrine + CFBundleIconFile + citrstart.icns + CFBundleShortVersionString + 0.01 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + IFMajorVersion + 0 + IFMinorVersion + 1 + + diff --git a/plugins/media/makefile.mac b/plugins/media/makefile.mac index 02a61ba3..c49e38b1 100644 --- a/plugins/media/makefile.mac +++ b/plugins/media/makefile.mac @@ -1,9 +1,9 @@ # Usage example: -# ISO="nl" PACKAGE="media" NAME="libctrmedia.dylib" make plugin +# FRAMEWORKS="/path/to/frameworks" ISO="nl" PACKAGE="media" NAME="libctrmedia.dylib" make plugin LDFLAGS= -shared -undefined dynamic_lookup -CFLAGS= -D REPLACE_MEDIA_ESPEAK -D NO_MEDIA_ESPEAK\ - -D REPLACE_MEDIA_SOCK -D MAC_MEDIA_SOCK +CFLAGS= + install-libctrmedia.dylib: libctrmedia.dylib @@ -11,12 +11,12 @@ install-libctrmedia.dylib: libctrmedia.dylib libctrmedia.dylib: media.o cc ${LDFLAGS} \ - -F/Library/Frameworks -framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer\ - -rpath /Library/Frameworks \ + -F${FRAMEWORKS} -framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer\ + -lffi -rpath @executable_path \ -lcurl -o libctrmedia.dylib media.o media.o: - cc ${CFLAGS} -D SDL -D LIBCURL -I . -c media.c -I ../../i18n/${ISO} -I i18n/${ISO} -Wall -Wunused-but-set-variable -fPIC -o media.o + cc ${CFLAGS} -D SDL -D LIBCURL -D FFI -I . -c media.c -I ../../i18n/${ISO} -I i18n/${ISO} -Wall -Wunused-but-set-variable -fPIC -o media.o clean: rm -rf *.dylib