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

Commit f71f9ed

Browse files
Merge branch 'develop-6.7' of https://github.com/runrev/livecode into merge-6.7
2 parents 023e29a + 05ed700 commit f71f9ed

File tree

12 files changed

+256
-47
lines changed

12 files changed

+256
-47
lines changed

INSTALL-android.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,44 @@ mkdir -p ~/android/toolchain
2323
cd ~/android/toolchain
2424

2525
tar -xf ~/Downloads/android-sdk_r24.1.2-linux.tgz
26-
7z x ~/Downloads/android-ndk-r10d-linux-x86_64.bin
26+
7z x ~/Downloads/android-ndk-r10e-linux-x86_64.bin
2727
````
2828

2929
Update the SDK:
3030

31-
android-sdk-linuxl/tools/android update sdk --no-ui
31+
android-sdk-linux/tools/android update sdk --no-ui
3232

3333
### Setting up the ARM toolchain
3434

3535
Create a standalone toolchain (this simplifies setting up the build environment):
3636

3737
````bash
38-
android-ndk-r10d/build/tools/make-standalone-toolchain.sh \
39-
--toolchain=arm-linux-androideabi-clang3.4 \
38+
android-ndk-r10e/build/tools/make-standalone-toolchain.sh \
39+
--toolchain=arm-linux-androideabi-clang3.5 \
4040
--platform=android-8 \
41-
--install-dir=~/android/toolchain/standalone
41+
--install-dir=${HOME}/android/toolchain/standalone
4242
````
4343

4444
By default, the Android toolchain uses the `gold` linker. However, this doesn't work for compiling LiveCode, so it's necessary to change the default linker to `ld.bfd` by replacing the `ld` symlink:
4545

4646
````bash
4747
rm standalone/bin/arm-linux-androideabi-ld
48-
ln -s standalone/bin/arm-linux-androideabi-ld.bfd \
48+
ln -s arm-linux-androideabi-ld.bfd \
4949
standalone/bin/arm-linux-androideabi-ld
5050
````
5151

52+
Add a couple of symlinks to allow the engine configuration script to find the Android toolchain:
53+
54+
````bash
55+
ln -s android-ndk-r10e android-ndk
56+
ln -s android-sdk-linux android-sdk
57+
````
58+
5259
## Configuring LiveCode
5360

5461
### Build environment
5562

56-
The Android build expects a large number of environment variables to be set. If the environment variables aren't set, the build process will attempt to guess sensible defaults.
63+
The Android build expects a large number of environment variables to be set. If the environment variables aren't set, the build process will attempt to guess sensible defaults. If you've set up the directory structure as described above, the make command should detect everything automatically and these variables shouldn't be necessary.
5764

5865
The following script will set up the environment variables correctly. You may need to edit it depending on where your JDK and ARM toolchain are installed:
5966

config.sh

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ fi
204204
# If no output type specified, guess from platform:
205205
if test -z "$FORMATS"; then
206206
case ${OS} in
207-
linux|android) FORMATS="make" ;;
207+
# Always use Linux-style makefiles for Android as the Android toolchain
208+
# is more Linux-y than Darwin-y
209+
linux|android) FORMATS="make-linux" ;;
208210
mac|ios) FORMATS="xcode" ;;
209211
win) FORMATS="msvs" ;;
210212
esac
@@ -258,23 +260,91 @@ if test -z "$TARGET_ARCH"; then
258260
esac
259261
fi
260262

263+
# Location of Perl when running Windows builds
264+
WIN_PERL=${WIN_PERL:-"C:/perl/bin/perl.exe"}
265+
261266
# Android default settings and tools
262-
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-22.0.1}
263-
ANDROID_JAVA_SDK=${ANDROID_JAVA_SDK:-${JAVA_SDK:-/usr/lib/jvm/java-7-openjdk-amd64}}
264267
ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-r10d}
265-
ANDROID_NDK=${ANDROID_NDK:-${HOME}/Workspace/android-ndk-${ANDROID_NDK_VERSION}}
266268
ANDROID_PLATFORM=${ANDROID_PLATFORM:-android-8}
267-
ANDROID_SDK=${ANDROID_SDK:-${HOME}/Workspace/android-sdk-linux}
268269

269-
ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN:-${HOME}/android-armv6-standalone/bin/arm-linux-androideabi-}
270+
# Attempt to locate an Android NDK
271+
if [ -z "${ANDROID_NDK}" ] ; then
272+
# Try the symlink we suggest in INSTALL-android.md
273+
if [ -d "${HOME}/android/toolchain/android-ndk" ] ; then
274+
ANDROID_NDK="${HOME}/android/toolchain/android-ndk"
275+
else
276+
if [ "${OS}" = "android" ] ; then
277+
echo >&2 "Error: Android NDK not found (set \$ANDROID_NDK)"
278+
exit 1
279+
fi
280+
fi
281+
fi
282+
283+
# Attempt to locate an Android SDK
284+
if [ -z "${ANDROID_SDK}" ] ; then
285+
# Try the symlink we suggest in INSTALL-android.md
286+
if [ -d "${HOME}/android/toolchain/android-sdk" ] ; then
287+
ANDROID_SDK="${HOME}/android/toolchain/android-sdk"
288+
else
289+
if [ "${OS}" = "android" ] ; then
290+
echo >&2 "Error: Android SDK not found (set \$ANDROID_SDK)"
291+
exit 1
292+
fi
293+
fi
294+
fi
295+
296+
# Attempt to guess the Android build tools version
297+
if [ -z "${ANDROID_BUILD_TOOLS}" ] ; then
298+
# Check for a sub-folder in the appropriate place
299+
# Possibly fragile - are there ever multiple sub-folders?
300+
if [ ! "$(echo \"${ANDROID_SDK}/build-tools/\"*)" = "${ANDROID_SDK}/build-tools/*" ] ; then
301+
ANDROID_BUILD_TOOLS=$(basename $(echo "${ANDROID_SDK}/build-tools/"*))
302+
else
303+
if [ "${OS}" = "android" ] ; then
304+
echo >&2 "Error: Android build tools not found (set \$ANDROID_BUILD_TOOLS)"
305+
exit 1
306+
fi
307+
fi
308+
fi
309+
310+
if [ -z "${ANDROID_TOOLCHAIN}" ] ; then
311+
# Try the folder we suggest in INSTALL-android.md
312+
if [ -d "${HOME}/android/toolchain/standalone" ] ; then
313+
ANDROID_TOOLCHAIN="${HOME}/android/toolchain/standalone/bin/arm-linux-androideabi-"
314+
else
315+
if [ "${OS}" = "android" ] ; then
316+
echo >&2 "Error: Android toolchain not found (set \$ANDROID_TOOLCHAIN)"
317+
exit 1
318+
fi
319+
fi
320+
fi
270321

271322
ANDROID_AR=${AR:-${ANDROID_TOOLCHAIN}ar}
272323
ANDROID_CC=${CC:-${ANDROID_TOOLCHAIN}clang -target arm-linux-androideabi -march=armv6 -integrated-as}
273324
ANDROID_CXX=${CXX:-${ANDROID_TOOLCHAIN}clang -target arm-linux-androideabi -march=armv6 -integrated-as}
274325
ANDROID_LINK=${LINK:-${ANDROID_TOOLCHAIN}clang -target arm-linux-androideabi -march=armv6 -integrated-as}
275326
ANDROID_OBJCOPY=${OBJCOPY:-${ANDROID_TOOLCHAIN}objcopy}
327+
ANDROID_OBJDUMP=${OBJDUMP:-${ANDROID_TOOLCHAIN}objdump}
276328
ANDROID_STRIP=${STRIP:-${ANDROID_TOOLCHAIN}strip}
277329

330+
if [ -z "${JAVA_SDK}" ] ; then
331+
# Utility used to locate Java on OSX systems
332+
if [ -x /usr/libexec/java_home ] ; then
333+
ANDROID_JAVA_SDK="$(/usr/libexec/java_home)"
334+
elif [ -d /usr/lib/jvm/default ] ; then
335+
ANDROID_JAVA_SDK=/usr/lib/jvm/default
336+
elif [ -d /usr/lib/jvm/default-jvm ] ; then
337+
ANDROID_JAVA_SDK=/usr/lib/jvm/default-jvm
338+
else
339+
if [ "${OS}" = "android" ] ; then
340+
echo >&2 "Error: no Java SDK found - set \$JAVA_SDK"
341+
exit 1
342+
fi
343+
fi
344+
else
345+
ANDROID_JAVA_SDK="${JAVA_SDK}"
346+
fi
347+
278348

279349
################################################################
280350
# Invoke gyp
@@ -304,13 +374,15 @@ case ${OS} in
304374
export CXX="${ANDROID_CXX}"
305375
export LINK="${ANDROID_LINK}"
306376
export OBJCOPY="${ANDROID_OBJCOPY}"
377+
export OBJDUMP="${ANDROID_OBJDUMP}"
307378
export STRIP="${ANDROID_STRIP}"
308379
invoke_gyp $basic_args "-DOS=${OS}" "-Dtarget_arch=${TARGET_ARCH}" \
309380
-Dcross_compile=1 \
310381
"-Gandroid_ndk_version=${ANDROID_NDK_VERSION}" "$@"
311382
;;
312383
win)
313-
invoke_gyp $basic_args "-Gmsvs_version=${WIN_MSVS_VERSION}" "$@"
384+
invoke_gyp $basic_args "-Gmsvs_version=${WIN_MSVS_VERSION}" \
385+
"-Dperl=${WIN_PERL}" "$@"
314386
;;
315387
mac|ios)
316388
invoke_gyp $basic_args "-DOS=${OS}" \

config/android.gypi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'variables':
77
{
8-
'java_sdk_path%': '<!(echo ${JAVA_SDK:-/usr/lib/jvm/java-6-openjdk-amd64})',
8+
'java_sdk_path%': '<!(echo ${JAVA_SDK})',
99
'android_sdk_path%': '<!(echo ${ANDROID_SDK})',
1010
'android_ndk_path%': '<!(echo ${ANDROID_NDK})',
1111
'android_platform%': '<!(echo ${ANDROID_PLATFORM})',
@@ -22,6 +22,11 @@
2222
'java_classpath': '<(android_sdk_path)/platforms/<(android_platform)/android.jar',
2323

2424
'output_dir': '../android-<(target_arch)-bin',
25+
26+
# Capture the values of some build tool environment vars
27+
'objcopy': '<!(echo ${OBJCOPY:-objcopy})',
28+
'objdump': '<!(echo ${OBJDUMP:-objdump})',
29+
'strip': '<!(echo ${STRIP:-strip})',
2530
},
2631

2732
'target_defaults':
@@ -89,7 +94,7 @@
8994
{
9095
'cflags':
9196
[
92-
'-Og',
97+
'-O0',
9398
'-g3',
9499
],
95100

config/debug_syms.gypi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
],
1313

1414
'extract-debug-symbols_path': '../tools/extract-debug-symbols.sh',
15+
16+
# These tools are only used for Linux and Android targets
17+
'objcopy%': '',
18+
'objdump%': '',
19+
'strip%': '',
1520
},
1621

1722
'actions':
@@ -33,6 +38,10 @@
3338

3439
'action':
3540
[
41+
'env',
42+
'OBJCOPY=<(objcopy)',
43+
'OBJDUMP=<(objdump)',
44+
'STRIP=<(strip)',
3645
'<(extract-debug-symbols_path)',
3746
'<(OS)',
3847
'>(debug_info_suffix)',

config/linux.gypi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
'variables':
33
{
44
'output_dir': '../linux-<(target_arch)-bin',
5+
6+
# Capture the values of some build tool environment vars
7+
'objcopy': '<!(echo ${OBJCOPY:-objcopy})',
8+
'objdump': '<!(echo ${OBJDUMP:-objdump})',
9+
'strip': '<!(echo ${STRIP:-strip})',
510
},
611

712
'target_defaults':
@@ -125,7 +130,7 @@
125130
{
126131
'cflags':
127132
[
128-
'-Og',
133+
'-O0',
129134
'-g3',
130135
],
131136

config/perl.gypi

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
{
22
'variables':
33
{
4-
'conditions':
5-
[
6-
[
7-
'host_os == "win"',
8-
{
9-
'perl': [ 'C:/perl/bin/perl.exe' ],
10-
},
11-
{
12-
'perl': [ 'perl' ],
13-
},
14-
],
15-
],
4+
'perl%': [ 'perl' ],
165
},
176
}

config/win32.gypi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
'variables':
33
{
44
# Path to the Windows SDK for Apple QuickTime
5-
'quicktime_sdk': '$(foo)C:/Program Files/QuickTime SDK',
5+
'quicktime_sdk%': '$(foo)C:/Program Files/QuickTime SDK',
66

77
# Path to versions 4 and 5 of the Microsoft Speech SDK
8-
'ms_speech_sdk4': '$(foo)C:/Program Files/Microsoft Speech SDK',
9-
'ms_speech_sdk5': '$(foo)C:/Program Files/Microsoft Speech SDK 5.1',
8+
'ms_speech_sdk4%': '$(foo)C:/Program Files/Microsoft Speech SDK',
9+
'ms_speech_sdk5%': '$(foo)C:/Program Files/Microsoft Speech SDK 5.1',
1010

1111
'output_dir': '../win-<(target_arch)-bin',
1212
},

configure.bat

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1-
python.exe gyp\gyp_main.py --format msvs --depth . --generator-output build-win-x86/livecode -Gmsvs_version=2010
1+
@echo off
2+
REM Configures the Windows build
3+
4+
SETLOCAL EnableExtensions
5+
6+
REM Set this variable if any warnings have been reported
7+
SET warnings=0
8+
9+
REM Not all versions of windows the the %programfiles(x86)% variable
10+
IF NOT DEFINED programfiles(x86) SET programfiles(x86)=%programfiles%
11+
12+
REM Note: to test whether a directory exists in batch script, you need to check
13+
REM whether a file within that directory exists. Easiest way to do this is to
14+
REM add the "*" wildcard after the directory
15+
16+
REM Attempt to locate a copy of Perl
17+
WHERE /Q perl 1>NUL 2>NUL
18+
IF %ERRORLEVEL% NEQ 0 (
19+
IF EXIST C:\perl64\bin\perl.exe (
20+
SET extra_options=%extra_options% -Dperl="C:/perl64/bin/perl.exe"
21+
) ELSE IF EXIST C:\perl\bin\perl.exe (
22+
SET extra_options=%extra_options% -Dperl="C:/perl/bin/perl.exe"
23+
) ELSE (
24+
ECHO >&2 Error: could not locate a copy of perl
25+
PAUSE
26+
EXIT 1
27+
)
28+
)
29+
30+
REM Attempt to locate a copy of Python
31+
WHERE /Q python 1>NUL 2>NUL
32+
IF %ERRORLEVEL% NEQ 0 (
33+
IF EXIST C:\Python27\python.exe (
34+
SET python=C:\Python27\python.exe
35+
) ELSE IF EXIST C:\Python26\python.exe (
36+
SET python=C:\Python26\python.exe
37+
) ELSE (
38+
ECHO >&2 Error: could not locate a copy of python
39+
PAUSE
40+
EXIT 1
41+
)
42+
) ELSE (
43+
SET python=python
44+
)
45+
46+
REM Attempt to locate the QuickTime SDK
47+
IF EXIST "%programfiles(x86)%\QuickTime SDK\*" (
48+
SET extra_options=%extra_options% -Dquicktime_sdk="%programfiles(x86)%/QuickTime SDK"
49+
) ELSE (
50+
ECHO >&2 Error: could not locate the QuickTime SDK
51+
PAUSE
52+
EXIT 1
53+
)
54+
55+
REM Attempt to locate the Microsoft Speech SDK v5.1
56+
IF EXIST "%programfiles(x86)%\Microsoft Speech SDK 5.1\*" (
57+
SET extra_options=%extra_options% -Dms_speech_sdk5="%programfiles(x86)%/Microsoft Speech SDK 5.1"
58+
) ELSE (
59+
ECHO >&2 Warning: could not locate the Microsoft Speech SDK v5.1; revSpeech will not build
60+
SET warnings=1
61+
)
62+
63+
REM Attempt to locate the Microsoft Speech SDK v4
64+
IF EXIST "%programfiles(x86)%\Microsoft Speech SDK\*" (
65+
SET extra_options=%extra_options% -Dms_speech_sdk4="%programfiles(x86)%/Microsoft Speech SDK"
66+
) ELSE (
67+
ECHO >&2 Warning: could not locate the Microsoft Speech SDK v4; revSpeech will not build
68+
SET warnings=1
69+
)
70+
71+
REM Pause so any warnings can be seen
72+
IF %warnings% NEQ 0 PAUSE
73+
74+
REM Run the configure step
75+
%python% gyp\gyp_main.py --format msvs --depth . --generator-output build-win-x86/livecode -Gmsvs_version=2010 %extra_options%
76+
77+
REM Pause if there was an error so that the user gets a chance to see it
78+
IF %ERRORLEVEL% NEQ 0 PAUSE
279
EXIT %ERRORLEVEL%
380

0 commit comments

Comments
 (0)