Skip to content

Commit

Permalink
Merge with mac-branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Jan 25, 2025
1 parent 896e7a8 commit 1a9122a
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 16 deletions.
12 changes: 8 additions & 4 deletions makefile.mac
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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}
cd plugins/${PACKAGE} ; make -f makefile.mac clean ; make -f makefile.mac install-${NAME}


53 changes: 47 additions & 6 deletions misc/distrib_osx.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,22 +1,63 @@


VERSION="1_0_0" #for files
VERSION_NAME="1.0.0" #for display

cd ..

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
26 changes: 26 additions & 0 deletions misc/export/assets/Citrine.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>Citrine</string>
<key>CFBundleExecutable</key>
<string>{CTRVERSION}</string>
<key>CFBundleIdentifier</key>
<string>nl.gaborsoftware.www</string>
<key>CFBundleName</key>
<string>Citrine</string>
<key>CFBundleIconFile</key>
<string>citrstart.icns</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
</dict>
</plist>
12 changes: 6 additions & 6 deletions plugins/media/makefile.mac
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# 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
install libctrmedia.dylib ../../mods/media/

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
Expand Down

0 comments on commit 1a9122a

Please sign in to comment.