Skip to content

Commit 1a9122a

Browse files
committed
Merge with mac-branch.
1 parent 896e7a8 commit 1a9122a

File tree

4 files changed

+87
-16
lines changed

4 files changed

+87
-16
lines changed

makefile.mac

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
CFLAGS = -O2 -std=c99 -mtune=native -Wall -D CTRLANG=${ISO} -D PATH_MAX=1024 \
22
-D REPLACE_PLUGIN_SYSTEM -D MACOS_PLUGIN_SYSTEM
3-
OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
4-
world.o lexer.o parser.o walker.o translator.o citrine.o portability.o
3+
OBJS = ${EMBED} test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
4+
world.o lexer.o parser.o walker.o translator.o citrine.o portability.o
5+
56

67
.SUFFIXES: .o .c
78

@@ -11,13 +12,16 @@ install: ctr
1112
cp ./ctr /usr/bin/ctr
1213

1314
ctr: $(OBJS)
14-
$(CC) $(OBJS) -rdynamic -undefined dynamic_lookup -lm -o bin/Mac/ctr${ISO}
15+
$(CC) $(OBJS) -rdynamic -undefined dynamic_lookup ${LDFLAGS} -lm -o bin/Mac/ctr${ISO}
1516

1617
.c.o:
1718
$(CC) $(CFLAGS) $(EXTRACFLAGS) -I i18n/${ISO} -c $<
19+
1820

1921
clean:
2022
rm -rf ${OBJS} ctr
2123

2224
plugin:
23-
cd plugins/${PACKAGE} ; make -f makefile.mac clean ; make -f makefile.mac install-${NAME}
25+
cd plugins/${PACKAGE} ; make -f makefile.mac clean ; make -f makefile.mac install-${NAME}
26+
27+

misc/distrib_osx.sh

100644100755
Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
1-
1+
2+
VERSION="1_0_0" #for files
3+
VERSION_NAME="1.0.0" #for display
24

35
cd ..
46

57
rm -rf dist/osx
68
mkdir dist/osx
79
rm bin/Mac/*
810

9-
declare -a langs=("nl" "en")
11+
12+
declare -a langs=("en" "nl")
1013
for lang in "${langs[@]}"
1114
do
1215

13-
mkdir -p dist/osx/$lang/mods/media
14-
cp tpl/$lang/* dist/osx/$lang/
1516
rm mods/media/libctrmedia.dylib
1617
ISO="$lang" make -f makefile.mac clean
1718
ISO="$lang" OS="Mac" make -f makefile.mac
1819
ISO="$lang" PACKAGE="media" NAME="libctrmedia.dylib" make -f makefile.mac plugin
19-
mv ./bin/Mac/ctr$lang dist/osx/$lang/ctr$lang
20-
mv ./mods/media/libctrmedia.dylib dist/osx/$lang/mods/media/
20+
21+
# Create dictionary
22+
./bin/Mac/ctren -g i18n/en/dictionary.h i18n/$lang/dictionary.h > /tmp/dict_general.dict
23+
./bin/Mac/ctren -g plugins/media/i18n/en/media.h plugins/media/i18n/$lang/media.h > /tmp/dict_media.dict
24+
cat /tmp/dict_general.dict /tmp/dict_media.dict plugins/media/i18n/$lang/extra.dict > /tmp/dict_all.dict
25+
26+
# (Re-)Create folder for lang specific distribution
27+
28+
mkdir -p dist/osx/ISO/$lang
29+
mkdir -p dist/osx/OUT/$lang
30+
31+
mkdir dist/osx/ISO/$lang/mods
32+
mkdir dist/osx/ISO/$lang/mods/media
33+
34+
# Add executable
35+
cp ./bin/Mac/ctr$lang dist/osx/ISO/$lang/ctr$lang
36+
# Add dynamic libraries
37+
cp ./mods/media/libctrmedia.dylib dist/osx/ISO/$lang/mods/media/
38+
39+
# Add assets
40+
cp demodata dist/osx/ISO/$lang/
41+
42+
# Translate examples
43+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo1.ctr > dist/osx/ISO/$lang/demo1.ctr 2>/tmp/err1.log
44+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo2.ctr > dist/osx/ISO/$lang/demo2.ctr 2>/tmp/err2.log
45+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo3.ctr > dist/osx/ISO/$lang/demo3.ctr 2>/tmp/err3.log
46+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo4.ctr > dist/osx/ISO/$lang/demo4.ctr 2>/tmp/err4.log
47+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo5.ctr > dist/osx/ISO/$lang/demo5.ctr 2>/tmp/err5.log
48+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo6.ctr > dist/osx/ISO/$lang/demo6.ctr 2>/tmp/err6.log
49+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo7.ctr > dist/osx/ISO/$lang/demo7.ctr 2>/tmp/err7.log
50+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo8.ctr > dist/osx/ISO/$lang/demo8.ctr 2>/tmp/err8.log
51+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo9.ctr > dist/osx/ISO/$lang/demo9.ctr 2>/tmp/err9.log
52+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo10.ctr > dist/osx/ISO/$lang/demo10.ctr 2>/tmp/err10.log
53+
./bin/Mac/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo11.ctr > dist/osx/ISO/$lang/demo11.ctr 2>/tmp/err11.log
54+
./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
55+
56+
rm -rf /tmp/dist$lang
57+
cp -R dist/osx/ISO/$lang /tmp/dist$lang
58+
cp -R ~/frameworks/* /tmp/dist$lang # put SDL2 frameworks for macos here to craft dist
59+
#cp -R ~/libs/* /tmp/dist$lang # other libs
60+
61+
hdiutil create -volname ctr${lang}${VERSION} -srcfolder /tmp/dist$lang -ov -format UDZO dist/osx/OUT/$lang/ctr${lang}${VERSION}.dmg
2162

2263
done
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleGetInfoString</key>
6+
<string>Citrine</string>
7+
<key>CFBundleExecutable</key>
8+
<string>{CTRVERSION}</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>nl.gaborsoftware.www</string>
11+
<key>CFBundleName</key>
12+
<string>Citrine</string>
13+
<key>CFBundleIconFile</key>
14+
<string>citrstart.icns</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>0.01</string>
17+
<key>CFBundleInfoDictionaryVersion</key>
18+
<string>6.0</string>
19+
<key>CFBundlePackageType</key>
20+
<string>APPL</string>
21+
<key>IFMajorVersion</key>
22+
<integer>0</integer>
23+
<key>IFMinorVersion</key>
24+
<integer>1</integer>
25+
</dict>
26+
</plist>

plugins/media/makefile.mac

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Usage example:
2-
# ISO="nl" PACKAGE="media" NAME="libctrmedia.dylib" make plugin
2+
# FRAMEWORKS="/path/to/frameworks" ISO="nl" PACKAGE="media" NAME="libctrmedia.dylib" make plugin
33

44
LDFLAGS= -shared -undefined dynamic_lookup
5-
CFLAGS= -D REPLACE_MEDIA_ESPEAK -D NO_MEDIA_ESPEAK\
6-
-D REPLACE_MEDIA_SOCK -D MAC_MEDIA_SOCK
5+
CFLAGS=
6+
77

88

99
install-libctrmedia.dylib: libctrmedia.dylib
1010
install libctrmedia.dylib ../../mods/media/
1111

1212
libctrmedia.dylib: media.o
1313
cc ${LDFLAGS} \
14-
-F/Library/Frameworks -framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer\
15-
-rpath /Library/Frameworks \
14+
-F${FRAMEWORKS} -framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer\
15+
-lffi -rpath @executable_path \
1616
-lcurl -o libctrmedia.dylib media.o
1717

1818
media.o:
19-
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
19+
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
2020

2121
clean:
2222
rm -rf *.dylib

0 commit comments

Comments
 (0)