Skip to content

Commit c0cf614

Browse files
committed
make debug distribution conditional on the -g flag being passed to ./distribute.sh
1 parent c14935e commit c0cf614

File tree

10 files changed

+51
-17
lines changed

10 files changed

+51
-17
lines changed

distribute.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,13 @@ function push_arm() {
135135
#export OFLAG="-Os"
136136
#export OFLAG="-O2"
137137

138-
export CFLAGS="-DANDROID -mandroid $OFLAG -g -fomit-frame-pointer --sysroot $NDKPLATFORM"
138+
if [ "X$DO_DEBUG_BUILD" == "X1" ]; then
139+
CFLAGS_G="-g"
140+
fi
141+
142+
export CFLAGS="-DANDROID -mandroid $OFLAG $CFLAGS_G -fomit-frame-pointer --sysroot $NDKPLATFORM"
139143
if [ "X$ARCH" == "Xarmeabi-v7a" ]; then
140-
CFLAGS+=" -march=armv7-a -g -mfloat-abi=softfp -mfpu=vfp -mthumb"
144+
CFLAGS+=" -march=armv7-a $CFLAGS_G -mfloat-abi=softfp -mfpu=vfp -mthumb"
141145
fi
142146
export CXXFLAGS="$CFLAGS"
143147

@@ -221,6 +225,7 @@ function usage() {
221225
echo " -m 'mod1 mod2' Modules to include"
222226
echo " -f Restart from scratch (remove the current build)"
223227
echo " -x display expanded values (execute 'set -x')"
228+
echo " -g create a distribution with debug symbols activated, to use with gdb-remote"
224229
echo
225230
exit 0
226231
}
@@ -614,10 +619,13 @@ function run_distribute() {
614619
try rm -rf lib-dynload/_ctypes_test.so
615620
try rm -rf lib-dynload/_testcapi.so
616621

617-
#debug "Strip libraries"
618-
#push_arm
619-
#try find "$DIST_PATH"/private "$DIST_PATH"/libs -iname '*.so' -exec $STRIP {} \;
620-
#pop_arm
622+
if [ "X$DO_DEBUG_BUILD" == "X" ]
623+
then
624+
debug "Strip libraries"
625+
push_arm
626+
try find "$DIST_PATH"/private "$DIST_PATH"/libs -iname '*.so' -exec $STRIP {} \;
627+
pop_arm
628+
fi
621629

622630
}
623631

@@ -664,7 +672,7 @@ function arm_deduplicate() {
664672

665673

666674
# Do the build
667-
while getopts ":hvlfxm:d:s" opt; do
675+
while getopts ":hvlfxm:d:s:g" opt; do
668676
case $opt in
669677
h)
670678
usage
@@ -692,6 +700,10 @@ while getopts ":hvlfxm:d:s" opt; do
692700
x)
693701
DO_SET_X=1
694702
;;
703+
g)
704+
# need to export so recipes can test on it
705+
export DO_DEBUG_BUILD=1
706+
;;
695707
\?)
696708
echo "Invalid option: -$OPTARG" >&2
697709
exit 1

recipes/cymunk/recipe.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ function build_cymunk() {
2020

2121
try find . -iname '*.pyx' -exec cython {} \;
2222
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
23-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
23+
if [ "X$DO_DEBUG_BUILD" == "X" ]
24+
then
25+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
26+
fi
2427

2528
export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
2629
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages

recipes/kivy/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function build_kivy() {
2727
$BUILD_PATH/python-install/bin/python.host setup.py build_ext
2828
try find . -iname '*.pyx' -exec cython {} \;
2929
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
30-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
30+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
31+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
32+
fi
3133
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
3234

3335
try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/kivy/tools

recipes/lxml/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ function build_lxml() {
3030
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -I$BUILD_libxml2/include -I$BUILD_libxslt
3131
try find . -iname '*.pyx' -exec cython {} \;
3232
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
33-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
33+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
34+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
35+
fi
3436

3537
export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
3638
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages

recipes/pycrypto/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ function build_pycrypto() {
2929
try ./configure --host=arm-eabi --prefix="$BUILD_PATH/python-install" --enable-shared
3030

3131
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
32-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
32+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
33+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
34+
fi
3335

3436
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
3537

recipes/pygame/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function build_pygame() {
3636
export LDFLAGS="$LDFLAGS -L$LIBS_PATH -L$SRC_PATH/obj/local/$ARCH/ -lm -lz"
3737
export LDSHARED="$LIBLINK"
3838
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
39-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
39+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
40+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
41+
fi
4042

4143
try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/pygame/docs
4244
try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/pygame/examples

recipes/pyjnius/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function build_pyjnius() {
2828
$BUILD_PATH/python-install/bin/python.host setup.py build_ext
2929
try find . -iname '*.pyx' -exec cython {} \;
3030
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
31-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
31+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
32+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
33+
fi
3234
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
3335
try cp -a jnius/src/org $JAVACLASS_PATH
3436

recipes/pyopenssl/recipe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ function build_pyopenssl() {
3131
export LDFLAGS="$LDFLAGS -L$LIBS_PATH -L$BUILD_openssl"
3232

3333
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
34-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
34+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
35+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
36+
fi
3537

3638
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
3739

recipes/python/recipe.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function prebuild_python() {
3333
try patch -p1 < $RECIPE_python/patches/fix-dlfcn.patch
3434

3535
# for debug
36-
try patch -p1 < $RECIPE_python/patches/no-optim.patch
36+
if [ "X$DO_DEBUG_BUILD" != "X" ]; then
37+
try patch -p1 < $RECIPE_python/patches/no-optim.patch
38+
fi
3739

3840
system=$(uname -s)
3941
if [ "X$system" == "XDarwin" ]; then
@@ -76,7 +78,9 @@ function build_python() {
7678
fi
7779

7880
# ok, it's a bit ugly
79-
sed 's/-O3/-O0/' -i configure
81+
if [ "X$DO_DEBUG_BUILD" != "X" ]; then
82+
sed 's/-O3/-O0/' -i configure
83+
fi
8084

8185
try ./configure --host=arm-eabi --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
8286
echo ./configure --host=arm-eabi --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework

recipes/twisted/recipe.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ function build_twisted() {
2929
$BUILD_PATH/python-install/bin/python.host setup.py build_ext
3030
try find . -iname '*.pyx' -exec cython {} \;
3131
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
32-
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
32+
33+
if [ "X$DO_DEBUG_BUILD" == "X" ]; then
34+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
35+
fi
3336

3437
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
3538

0 commit comments

Comments
 (0)