Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 07054bf

Browse files
[[ Bug 14625 ]] Update the way iOS externals are linked
build-extension-ios.sh (used by engine-mobile.xcodeproj) and the S/B are now following Xcode way: * build for armv7 * build for arm64 * lipo both of the generated files The generation of dylib has been removed, since unused by the mobile standalones
1 parent 9cf41d8 commit 07054bf

File tree

8 files changed

+82
-33
lines changed

8 files changed

+82
-33
lines changed

docs/notes/bugfix-14625.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# iOS standalones with RevZip externals and iOS Min Version >= 7.0 do not build

engine/engine-mobile.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@
20662066
);
20672067
runOnlyForDeploymentPostprocessing = 0;
20682068
shellPath = /bin/sh;
2069-
shellScript = "cp \"$TARGET_BUILD_DIR/revsecurity.dylib\" \"$TARGET_BUILD_DIR/standalone-mobile-community.app/\"";
2069+
shellScript = "#cp \"$TARGET_BUILD_DIR/revsecurity.dylib\" \"$TARGET_BUILD_DIR/standalone-mobile-community.app/\"";
20702070
};
20712071
/* End PBXShellScriptBuildPhase section */
20722072

ide-support/revdeploylibraryios.livecodescript

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ end deployIsAvailable
4444
function deployListTargets
4545
local tTargets
4646

47+
-- SN-2015-02-18: [[ ARM64 ]] We dropped support for
48+
-- iOS Simulators < 5.1
49+
put "5.1,6.1,7.1,8.1" into tAvailableSimulators
50+
4751
repeat for each key tKey in sDeploySimulators
48-
if tKey >= "4.2" then
52+
if tKey is among the items of tAvailableSimulators then
4953
put "iPad Simulator" && tKey & return after tTargets
5054
end if
51-
if tKey >= "4.0" then
55+
if tKey is among the items of tAvailableSimulators then
5256
put "iPhone Simulator" && tKey & return after tTargets
5357
end if
5458
end repeat

ide-support/revsaveasiosstandalone.livecodescript

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ private command revSaveAsMobileStandaloneMain pStack, pAppBundle, pTarget
342342
-- Make the minimum run version of the engine 4.3
343343
-- SN-2015-02-05: [[ Bug 14422 ]] The linker minimum iphoneOS version
344344
-- should be relevant with the desired minimum version.
345-
put revGetMinimumOSByArch(tSettings["ios,minimum version"]) into tVersion
346-
put "-miphoneos-version-min=" & tVersion["armv7"] & return after tLinkCommand
345+
-- SN-2015-02-19: [[ Bug 14625 ]] Minimum version is architecture-specific
346+
--put revGetMinimumOSByArch(tSettings["ios,minimum version"]) into tVersion
347+
--put "-miphoneos-version-min=" & tVersion["armv7"] & return after tLinkCommand
347348

348349
-- MW-2013-06-26: [[ CloneAndRun ]] Only dead strip if an installed env.
349350
if revEnvironmentIsInstalled() then
@@ -373,15 +374,6 @@ private command revSaveAsMobileStandaloneMain pStack, pAppBundle, pTarget
373374
end if
374375
end repeat
375376

376-
-- Make a temporary file for link options and execute it
377-
local tLinkOptionsFile
378-
put tempName() into tLinkOptionsFile
379-
380-
-- MM-2011-09-28: Create the engine for the instruction set specified in the build type setting.
381-
--
382-
put tempName() into tSDKs[tInstSet]["engine file"]
383-
put tLinkCommand & "-o" && quote & tSDKs[tInstSet]["engine file"] & quote & return into url ("binfile:" & tLinkOptionsFile)
384-
385377
-- Compute the list of archs in the fat binary
386378
local tRawArchs
387379
put shell("otool -fv" && quote & mapFilePath(tSDKs[tInstSet]["runtime path"] & slash & "Standalone") & quote) into tRawArchs
@@ -391,21 +383,50 @@ private command revSaveAsMobileStandaloneMain pStack, pAppBundle, pTarget
391383

392384
local tArchs
393385
if tRawArchs contains "ARM64" then
394-
put "-arch arm64 " after tArchs
386+
put "arm64 " after tArchs
395387
end if
396388
if tRawArchs contains "V7" then
397-
put "-arch armv7 " after tArchs
389+
put "armv7 " after tArchs
398390
end if
399391

400-
-- MM-2013-09-23: [[ iOS7 Support ]] Use g++ instead of llvm-g++-4.2. XCode 5.0 uses llvm 5.0.
401-
-- g++ appears to be sym-linked to the appropriate compiler in all SDKS.
392+
-- SN-2015-02-19: [[ Bug 14625 ]] Build each binary separately according
393+
-- to their architecture.
394+
put empty into tArchSpecificEngineList
395+
repeat for each word tArch in tArchs
396+
-- Make a temporary file for link options and execute it
397+
local tLinkOptionsFile
398+
put tempName() into tLinkOptionsFile
399+
400+
put tempName() into tArchSpecificEngineFile
401+
put tLinkCommand & "-o" && quote & tArchSpecificEngineFile & quote & return into url ("binfile:" & tLinkOptionsFile)
402+
403+
local tiPhoneMinVersion
404+
if tArch = "arm64" then
405+
put "7.0.0" into tiPhoneMinVersion
406+
else
407+
put "5.1.1" into tiPhoneMinVersion
408+
end if
409+
-- MM-2013-09-23: [[ iOS7 Support ]] Use g++ instead of llvm-g++-4.2. XCode 5.0 uses llvm 5.0.
410+
-- g++ appears to be sym-linked to the appropriate compiler in all SDKS.
411+
-- SN-2015-02-19: [[ Bug 14625 ]] The minimum iOS version is bound to the architecture
412+
get shell("g++ -arch " & tArch && "-miphoneos-version-min=" & tiPhoneMinVersion && quote & "@" & tLinkOptionsFile & quote)
413+
414+
put tArchSpecificEngineFile & space after tArchSpecificEngineList
415+
delete file tLinkOptionsFile
416+
if it is not empty or there is no file tArchSpecificEngineFile then
417+
throw "linking for" && tInstSet && " (" & tArch & ") failed with " & it
418+
end if
419+
end repeat
420+
421+
-- MM-2011-09-28: Create the engine for the instruction set specified in the build type setting.
402422
--
403-
get shell("g++ " & tArchs && quote & "@" & tLinkOptionsFile & quote)
423+
put tempName() into tSDKs[tInstSet]["engine file"]
424+
-- SN-2015-02-19: [[ Bug 14625 ]] Make the fat binary with the architecture-specific engines
425+
get shell("lipo -create " & tArchSpecificEngineList & " -output " & quote & tSDKs[tInstSet]["engine file"] & quote)
404426

405-
delete file tLinkOptionsFile
406427
if it is not empty or there is no file tSDKs[tInstSet]["engine file"] then
407428
throw "linking for" && tInstSet && "failed with " & it
408-
end if
429+
end if
409430

410431
-- Put the path back the way it was
411432
put tOldPath into $PATH

revzip/src/revzip.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
4646

4747
#if defined(TARGET_SUBPLATFORM_IPHONE) || defined(TARGET_SUBPLATFORM_ANDROID)
4848
#define stricmp strcasecmp
49+
#include <unistd.h>
4950
#endif
5051

5152
#define REVZIP_READ_BUFFER_SIZE 8192

rules/Global Mobile.xcconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ GCC_THREADSAFE_STATICS = NO
1212
SHARED_PRECOMPS_DIR=$(OBJROOT)/Precompiled/$(CURRENT_ARCH)
1313
GLOBAL_GCC_PREPROCESSOR_DEFINITIONS=_MOBILE TARGET_PLATFORM_MOBILE TARGET_SUBPLATFORM_IPHONE
1414
GCC_VERSION =
15-
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1
15+
IPHONEOS_DEPLOYMENT_TARGET[arch=armv7] = 5.1.1
16+
IPHONEOS_DEPLOYMENT_TARGET[arch=arm64] = 7.0.0
1617
TARGETED_DEVICE_FAMILY = 1,2
1718
ALWAYS_SEARCH_USER_PATHS = NO
1819
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
1920
SDKROOT=iphoneos
20-
ARCHS_STANDARD=armv7 arm64
21+
ARCHS_STANDARD=armv7 arm64

tools/build-extension-ios.sh

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ DEPS=`cat "$SRCROOT/$PRODUCT_NAME.ios"`
22
DEPS=${DEPS//library /-l}
33
DEPS=${DEPS//framework /-framework }
44

5-
ARCHS="-arch ${ARCHS// / -arch }"
65
if [ "$SYMBOLS" != "" ]; then
76
SYMBOLS="-Wl,-exported_symbol -Wl,${SYMBOLS// / -Wl,-exported_symbol -Wl,}"
87
fi
@@ -21,13 +20,39 @@ else
2120
BIN_DIR=$DEVELOPER_BIN_DIR
2221
fi
2322

24-
$BIN_DIR/g++ -dynamiclib $ARCHS -isysroot $SDKROOT -L"$SOLUTION_DIR/prebuilt/lib/ios/$SDK_NAME" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" -dead_strip -Wl,-x $SYMBOLS $DEPS
25-
2623
# MW-2011-09-19: Updated to build universal binary version of lcext - by passing
2724
# the process through g++ we get it all for free!
2825
# MW-2013-06-26: [[ CloneAndRun ]] When in 'Debug' mode, don't strip all global symbols.
2926
if [ $CONFIGURATION = "Debug" ]; then
30-
$BIN_DIR/g++ -nodefaultlibs -Wl,-r $ARCHS -isysroot $SDKROOT -L"$SOLUTION_DIR/prebuilt/lib/ios/$SDK_NAME" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.lcext" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" -Wl,-sectcreate -Wl,__MISC -Wl,__deps -Wl,"$SRCROOT/$PRODUCT_NAME.ios" -Wl,-exported_symbol -Wl,___libinfoptr_$PRODUCT_NAME $STATIC_DEPS
27+
STRIP_OPTIONS="-Wl,-r"
3128
else
32-
$BIN_DIR/g++ -nodefaultlibs -Wl,-r -Wl,-x $ARCHS -isysroot $SDKROOT -L"$SOLUTION_DIR/prebuilt/lib/ios/$SDK_NAME" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.lcext" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" -Wl,-sectcreate -Wl,__MISC -Wl,__deps -Wl,"$SRCROOT/$PRODUCT_NAME.ios" -Wl,-exported_symbol -Wl,___libinfoptr_$PRODUCT_NAME $STATIC_DEPS
29+
STRIP_OPTIONS="-Wl,-r -Wl,-x"
3330
fi
31+
32+
# SN-2015-02019: [[ Bug 14625 ]] We build and link each arch separately, and lipo them
33+
# togother once it's done.
34+
35+
LCEXT_FILES=""
36+
37+
# Link architecture-specifically the libraries
38+
for ARCH in $(echo $ARCHS | tr " " "\n")
39+
do
40+
LCEXT_FILE="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.lcext_${ARCH}"
41+
42+
# arm64 is only from iOS 7.0.0
43+
if [ ${ARCH} = "arm64" ]; then
44+
MIN_VERSION="7.0"
45+
else
46+
MIN_VERSION="5.1"
47+
fi
48+
49+
$BIN_DIR/g++ -nodefaultlibs $STRIP_OPTIONS -arch ${ARCH} -miphoneos-version-min=${MIN_VERSION} -isysroot $SDKROOT -L"$SOLUTION_DIR/prebuilt/lib/ios/$SDK_NAME" -o "${LCEXT_FILE}" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" -Wl,-sectcreate -Wl,__MISC -Wl,__deps -Wl,"$SRCROOT/$PRODUCT_NAME.ios" -Wl,-exported_symbol -Wl,___libinfoptr_$PRODUCT_NAME $STATIC_DEPS
50+
51+
LCEXT_FILES+=" ${LCEXT_FILE}"
52+
done
53+
54+
# Lipo the generated libs
55+
lipo -create ${LCEXT_FILES} -output "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.lcext"
56+
57+
# Cleanup the lcext_$ARCH files generated
58+
rm ${LCEXT_FILES}

tools/build-ios.osx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
BASEDIR=$(dirname $0)
22
cd $BASEDIR/..
33

4-
./sdks/Xcode_4_2/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator5.0 ARCHS=i386
4+
./sdks/Xcode_4_2/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator5.1 ARCHS=i386
55
./sdks/Xcode_4_6/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator6.1 ARCHS=i386
66
./sdks/Xcode_5_1/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator7.1 ARCHS="i386 x86_64"
7-
./sdks/Xcode_6_0/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator8.0 ARCHS="i386 x86_64"
87
./sdks/Xcode_6_1/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphonesimulator8.1 ARCHS="i386 x86_64"
98

10-
./sdks/Xcode_4_2/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphoneos5.0 ARCHS=armv7
11-
./sdks/Xcode_4_6/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphoneos6.1 ARCHS=armv7
12-
./sdks/Xcode_5_1/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphoneos7.1 ARCHS="armv7 arm64"
139
./sdks/Xcode_6_1/usr/bin/xcodebuild -project stage-mobile.xcodeproj -configuration Release -sdk iphoneos8.1 ARCHS="armv7 arm64"

0 commit comments

Comments
 (0)