Skip to content

Commit 46567c6

Browse files
[[ Gyp ]] Fix linking of iOS device engines
1 parent caa5091 commit 46567c6

File tree

7 files changed

+77
-32
lines changed

7 files changed

+77
-32
lines changed

engine/app-bundle-template.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'target_conditions':
1010
[
1111
[
12-
'_type != "none"',
12+
'_type == "executable"',
1313
{
1414
'mac_bundle': 1,
1515
},

engine/bind-ios-standalone.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ set -e
44

55
case "$1" in
66
*-community.lcext)
7-
SECTIONS="${SRCROOT}/standalone.ios"
7+
DEPS_FILE="${SRCROOT}/standalone.ios"
88
;;
99
*-commercial.lcext)
10-
SECTIONS="${SRCROOT}/../livecode/engine/standalone.ios"
10+
DEPS_FILE="${SRCROOT}/../livecode/engine/standalone.ios"
1111
;;
1212
esac
1313

1414
case "${SDKROOT}" in
15-
iphonesimulator*)
15+
*iPhoneOS*)
1616
case "$1" in
1717
*-community.lcext)
18-
ln -sf standalone-mobile-community.app/standalone-mobile-community "$BUILT_PRODUCTS_DIR/standalone-mobile-community.ios-engine"
18+
ln -sf standalone-mobile-lib-community.lcext "$BUILT_PRODUCTS_DIR/standalone-mobile-community.ios-engine"
1919
;;
2020
*-commercial.lcext)
21-
ln -sf standalone-mobile-commercial.app/standalone-mobile-commercial "$BUILT_PRODUCTS_DIR/standalone-mobile-commercial.ios-engine"
21+
ln -sf tandalone-mobile-lib-commercial.lcext "$BUILT_PRODUCTS_DIR/standalone-mobile-commercial.ios-engine"
2222
;;
2323
*)
2424
echo "Unexpected filename $1" >&2
@@ -36,23 +36,27 @@ else
3636
fi
3737

3838
if [ "${CONFIGURATION}" = "Debug" ] ; then
39-
STRIP_FLAG="-Wl,-x"
40-
else
4139
STRIP_FLAG=""
40+
else
41+
STRIP_FLAG="-Wl,-x"
4242
fi
4343

44-
"${BIN_DIR}/g++" -nodefaultlibs -Wl,-r ${STRIP_FLAG} -arch ${ARCHS//\ /\ -arch\ } -isysroot "${SDKROOT}" -o $@ -Wl,-sectcreate -Wl,-__MISC -Wl,__deps -Wl,"${SECTIONS}" -Wl,-exported_symbol -Wl,_main -Wl,-exported_symbol -Wl,_load_module -Wl,-exported_symbol -Wl,_resolve_symbol
45-
46-
case "$1" in
47-
*-community.lcext)
48-
ln -sf "$1" "$BUILT_PRODUCTS_DIR/standalone-mobile-community.ios-engine"
49-
;;
50-
*-commercial.lcext)
51-
ln -sf "$1" "$BUILT_PRODUCTS_DIR/standalone-mobile-commercial.ios-engine"
52-
;;
53-
*)
54-
echo "Unexpected filename $1" >&2
55-
exit 1
56-
;;
57-
esac
44+
# Process the list of imports into a linker command line
45+
while read dep; do
46+
read type name <<< "${dep}"
47+
case "${type}" in
48+
library)
49+
libs+=\ -l"${name}"
50+
;;
51+
framework)
52+
libs+=\ -framework\ "${name}"
53+
;;
54+
*)
55+
echo "Unknown dependency type ${type}" >&2
56+
exit 1
57+
;;
58+
esac
59+
done <"${DEPS_FILE}"
60+
61+
"${BIN_DIR}/g++" -ObjC ${libs} ${STRIP_FLAG} -arch ${ARCHS//\ /\ -arch\ } -isysroot "${SDKROOT}" -o $2 $1
5862

engine/engine-sources.gypi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@
397397
'src/mbliphonegfx.mm',
398398
'src/mbliphonehooks.cpp',
399399
'src/mbliphoneinput.mm',
400-
'src/mbliphonelocation.mm',
400+
#'src/mbliphonelocation.mm',
401401
'src/mbliphonemail.mm',
402402
'src/mbliphonemediapick.mm',
403403
'src/mbliphonemisc.mm',
@@ -807,6 +807,7 @@
807807

808808
'sources!':
809809
[
810+
'src/coretextlayout.mm',
810811
'src/srvmac.cpp',
811812
],
812813
},
@@ -933,6 +934,7 @@
933934
[
934935
'src/stacke.cpp',
935936
'src/sysunxdate.cpp',
937+
'src/sysunxrandom.cpp',
936938

937939
'src/mbliphoneembedded.mm',
938940
'src/mbliphoneembeddedtest.mm',

engine/engine.gyp

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,33 @@
212212
[
213213
'OS == "ios"',
214214
{
215-
'product_name': 'standalone-mobile-community',
215+
'product_name': 'standalone-mobile-lib-community',
216+
'product_prefix': '',
217+
'product_extension': 'lcext',
216218
'app_plist': 'rsrc/standalone-mobile-Info.plist',
219+
220+
'type': 'shared_library',
221+
222+
'variables':
223+
{
224+
'deps_file': '${SRCROOT}/standalone.ios',
225+
},
226+
227+
'xcode_settings':
228+
{
229+
'DEAD_CODE_STRIPPING': 'NO',
230+
'DYLIB_COMPATIBILITY_VERSION': '',
231+
'DYLIB_CURRENT_VERSION': '',
232+
'MACH_O_TYPE': 'mh_object',
233+
'OTHER_LDFLAGS':
234+
[
235+
'-Wl,-sectcreate,__MISC,__deps,<(deps_file)',
236+
'-Wl,-exported_symbol,_main',
237+
'-Wl,-exported_symbol,_load_module',
238+
'-Wl,-exported_symbol,_resolve_symbol',
239+
#'-all_load', # Dead stripping later will remove un-needed symbols
240+
],
241+
},
217242
},
218243
],
219244
[
@@ -377,7 +402,13 @@
377402
},
378403
],
379404
[
380-
'OS != "android"',
405+
'OS == "ios"',
406+
{
407+
'dist_files': [ '<(PRODUCT_DIR)/standalone-mobile-community.ios-engine' ],
408+
},
409+
],
410+
[
411+
'OS != "android" and OS != "ios"',
381412
{
382413
'dist_files': [ '<(PRODUCT_DIR)/<(_product_name)>(app_bundle_suffix)' ],
383414
}
@@ -565,7 +596,7 @@
565596
},
566597

567598
{
568-
'target_name': 'standalone-mobile-lib-community',
599+
'target_name': 'ios-standalone-executable',
569600
'type': 'none',
570601

571602
'dependencies':
@@ -586,20 +617,19 @@
586617

587618
'inputs':
588619
[
589-
'<(PRODUCT_DIR)/libkernel.a',
590-
'<(PRODUCT_DIR)/libkernel-standalone.a',
620+
'<(PRODUCT_DIR)/standalone-mobile-lib-community.lcext',
591621
],
592622

593623
'outputs':
594624
[
595-
'<(PRODUCT_DIR)/standalone-mobile-lib-community.lcext',
625+
'<(PRODUCT_DIR)/standalone-mobile-community.ios-engine',
596626
],
597627

598628
'action':
599629
[
600630
'./bind-ios-standalone.sh',
601-
'<@(_outputs)',
602631
'<@(_inputs)',
632+
'<@(_outputs)',
603633
],
604634
},
605635
],

libgraphics/libgraphics.gyp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@
5555
],
5656
},
5757
],
58+
[
59+
'OS == "ios"',
60+
{
61+
'sources!':
62+
[
63+
'src/coretext.cpp',
64+
],
65+
},
66+
],
5867
],
5968

6069
'direct_dependent_settings':

livecode.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
{
8484
'dependencies':
8585
[
86-
'engine/engine.gyp:standalone-mobile-lib-community',
86+
'engine/engine.gyp:ios-standalone-executable',
8787
],
8888
},
8989
],

thirdparty

0 commit comments

Comments
 (0)