Skip to content

Commit 7ac9606

Browse files
committed
try to support osx. not working yet, stuck on rpath error.
1 parent 60481dc commit 7ac9606

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

distribute.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
MODULES=$MODULES
1111

1212
# Paths
13-
ROOT_PATH="$(dirname $(readlink -f $0))"
13+
ROOT_PATH="$(dirname $(python -c 'import os,sys;print os.path.realpath(sys.argv[1])' $0))"
1414
RECIPES_PATH="$ROOT_PATH/recipes"
1515
BUILD_PATH="$ROOT_PATH/build"
1616
LIBS_PATH="$ROOT_PATH/build/libs"
@@ -23,6 +23,10 @@ DIST_PATH="$ROOT_PATH/dist/default"
2323
export LIBLINK_PATH="$BUILD_PATH/objects"
2424
export LIBLINK="$ROOT_PATH/src/tools/liblink"
2525
export BIGLINK="$ROOT_PATH/src/tools/biglink"
26+
MD5SUM=$(which md5sum)
27+
if [ "X$MD5SUM" == "X" ]; then
28+
MD5SUM="md5 -r"
29+
fi
2630

2731
# Internals
2832
CRED="\x1b[31;01m"
@@ -39,7 +43,7 @@ if [ $? -eq 0 ]; then
3943
export NDK_CCACHE="ccache"
4044
fi
4145

42-
#set -x
46+
set -x
4347

4448
function try () {
4549
"$@" || exit -1
@@ -98,7 +102,13 @@ function push_arm() {
98102
export CXXFLAGS="$CFLAGS"
99103

100104
# this must be something depending of the API level of Android
101-
export PATH="$ANDROIDNDK/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/:$ANDROIDNDK:$ANDROIDSDK/tools:$PATH"
105+
PYPLATFORM=$(python -c 'import sys; print sys.platform')
106+
if [ "$PYPLATFORM" == "linux2" ]; then
107+
PYPLATFORM="linux"
108+
elif [ "$PYPLATFORM" == "linux3" ]; then
109+
PYPLATFORM="linux"
110+
fi
111+
export PATH="$ANDROIDNDK/toolchains/arm-eabi-4.4.0/prebuilt/$PYPLATFORM-x86/bin/:$ANDROIDNDK:$ANDROIDSDK/tools:$PATH"
102112
if [ "X${ANDROIDNDKVER:0:2}" == "Xr7" ] || [ "X$ANDROIDNDKVER" == "Xr8" ]; then
103113
export TOOLCHAIN_PREFIX=arm-linux-androideabi
104114
export TOOLCHAIN_VERSION=4.4.3
@@ -110,7 +120,7 @@ function push_arm() {
110120
exit -1
111121
fi
112122

113-
export PATH="$ANDROIDNDK/toolchains/$TOOLCHAIN_PREFIX-$TOOLCHAIN_VERSION/prebuilt/linux-x86/bin/:$ANDROIDNDK:$ANDROIDSDK/tools:$PATH"
123+
export PATH="$ANDROIDNDK/toolchains/$TOOLCHAIN_PREFIX-$TOOLCHAIN_VERSION/prebuilt/$PYPLATFORM-x86/bin/:$ANDROIDNDK:$ANDROIDSDK/tools:$PATH"
114124

115125
# search compiler in the path, to fail now instead of later.
116126
CC=$(which $TOOLCHAIN_PREFIX-gcc)
@@ -219,7 +229,7 @@ function run_prepare() {
219229

220230
info "Check mandatory tools"
221231
# ensure that some tools are existing
222-
for tool in md5sum tar bzip2 unzip make gcc g++; do
232+
for tool in tar bzip2 unzip make gcc g++; do
223233
which $tool &>/dev/null
224234
if [ $? -ne 0 ]; then
225235
error "Tool $tool is missing"
@@ -274,7 +284,7 @@ function in_array() {
274284

275285
function run_source_modules() {
276286
needed=($MODULES)
277-
declare -A processed
287+
declare -a processed
278288
order=()
279289

280290
while [ ${#needed[*]} -ne 0 ]; do
@@ -285,13 +295,14 @@ function run_source_modules() {
285295
needed=( ${needed[@]} )
286296

287297
# check if the module have already been declared
288-
if [[ ${processed[$module]} ]]; then
298+
in_array $module "${processed[@]}"
299+
if [ $? -ne 255 ]; then
289300
debug "Ignored $module, already processed"
290301
continue;
291302
fi
292303

293304
# add this module as done
294-
processed[$module]=1
305+
processed=( ${processed[@]} $module )
295306

296307
# append our module at the end only if we are not exist yet
297308
in_array $module "${order[@]}"
@@ -369,7 +380,7 @@ function run_get_packages() {
369380
if [ -f $filename ]; then
370381
if [ -n "$md5" ]; then
371382
# check if the md5 is correct
372-
current_md5=$(md5sum $filename | cut -d\ -f1)
383+
current_md5=$($MD5SUM $filename | cut -d\ -f1)
373384
if [ "X$current_md5" == "X$md5" ]; then
374385
# correct, no need to download
375386
do_download=0
@@ -393,7 +404,7 @@ function run_get_packages() {
393404

394405
# check md5
395406
if [ -n "$md5" ]; then
396-
current_md5=$(md5sum $filename | cut -d\ -f1)
407+
current_md5=$($MD5SUM $filename | cut -d\ -f1)
397408
if [ "X$current_md5" != "X$md5" ]; then
398409
error "File $filename md5 check failed (got $current_md5 instead of $md5)."
399410
error "Ensure the file is correctly downloaded, and update MD5S_$module"

recipes/hostpython/recipe.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ function build_hostpython() {
2424

2525
try ./configure
2626
try make -j5
27-
try mv python hostpython
27+
bash
28+
try mv python.exe hostpython
2829
try mv Parser/pgen hostpgen
2930
#try mkdir -p ../prebuilt/Python-$PYVERSION/lib
3031
#try cp hostpython ../prebuilt/Python-$PYVERSION/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- Python-2.7.2/Makefile.pre.in.orig 2012-07-05 17:09:45.000000000 +0200
2+
+++ Python-2.7.2/Makefile.pre.in 2012-07-05 17:10:00.000000000 +0200
3+
@@ -435,7 +435,7 @@
4+
fi
5+
6+
libpython$(VERSION).dylib: $(LIBRARY_OBJS)
7+
- $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
8+
+ $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
9+
10+
11+
libpython$(VERSION).sl: $(LIBRARY_OBJS)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- Python-2.7.2/configure.orig 2012-07-05 16:44:36.000000000 +0200
2+
+++ Python-2.7.2/configure 2012-07-05 16:44:44.000000000 +0200
3+
@@ -13732,10 +13732,6 @@
4+
5+
fi
6+
7+
-if test $ac_sys_system = Darwin
8+
-then
9+
- LIBS="$LIBS -framework CoreFoundation"
10+
-fi
11+
12+
13+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5

recipes/python/recipe.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function prebuild_python() {
2727
try patch -p1 < $RECIPE_python/patches/fix-termios.patch
2828
try patch -p1 < $RECIPE_python/patches/custom-loader.patch
2929
try patch -p1 < $RECIPE_python/patches/verbose-compilation.patch
30+
try patch -p1 < $RECIPE_python/patches/fix-remove-corefoundation.patch
31+
try patch -p1 < $RECIPE_python/patches/fix-dynamic-lookup.patch
3032

3133
# everything done, touch the marker !
3234
touch .patched
@@ -55,8 +57,9 @@ function build_python() {
5557
export LDFLAGS="$LDFLAGS -L$BUILD_openssl/"
5658
fi
5759

58-
try ./configure --host=arm-eabi --prefix="$BUILD_PATH/python-install" --enable-shared
59-
try $MAKE HOSTPYTHON=$BUILD_python/hostpython HOSTPGEN=$BUILD_python/hostpgen CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
60+
try ./configure --host=arm-eabi --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
61+
echo $MAKE HOSTPYTHON=$BUILD_python/hostpython HOSTPGEN=$BUILD_python/hostpgen CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
62+
bash
6063
cp HOSTPYTHON=$BUILD_python/hostpython python
6164

6265
# FIXME, the first time, we got a error at:

0 commit comments

Comments
 (0)