From 65b064fe8232f0bf0ece2cbd1ca80c041be9c4a3 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 18 Jun 2014 16:09:46 +0000 Subject: [PATCH] build-binary-dist.sh: updated to include the Python binding to the C run-time There are also some changes in src/runtime/python/setyp.py to support this. --- bin/build-binary-dist.sh | 28 +++++++++++++++++++++------- src/runtime/python/setup.py | 10 ++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/bin/build-binary-dist.sh b/bin/build-binary-dist.sh index 8a018a6f3..cf8caf218 100644 --- a/bin/build-binary-dist.sh +++ b/bin/build-binary-dist.sh @@ -14,22 +14,36 @@ destdir=/tmp/gf-binary-dist-$$ # assemble binary dist here prefix=/usr/local # where to install targz=gf-$ver-bin-$hw-$os.tar.gz # the final tar file +extralib="$destdir$prefix/lib" +extrainclude="$destdir$prefix/include" +extra="--extra-lib-dirs=$extralib --extra-include-dirs=$extrainclude" + set -e # Stop if an error occurs set -x # print commands before exuting them ## First configure & build the C run-time system -( -cd src/runtime/c +pushd src/runtime/c bash setup.sh configure --prefix=$prefix bash setup.sh build bash setup.sh install prefix=$destdir$prefix -) +popd -## Now build GF, with C run-time support enabled +## Build the python binding to the C run-time system +pushd src/runtime/python +EXTRA_INCLUDE_DIRS="$extrainclude" EXTRA_LIB_DIRS="$extralib" python setup.py build +python setup.py install --prefix=$destdir$prefix +popd + +## Build the Java binding to the C run-time system +pushd src/runtime/java +# not implemented yet +popd + +## Build GF, with C run-time support enabled cabal install --only-dependencies -cabal configure --prefix=$prefix -fserver -fc-runtime --extra-lib-dirs=$destdir$prefix/lib --extra-include-dirs=$destdir$prefix/include -cabal build -cabal copy --destdir=$destdir +cabal configure --prefix=$prefix -fserver -fc-runtime $extra +DYLD_LIBRARY_PATH="$extralib" LD_LIBRARY_PATH="$extralib" cabal build +DYLD_LIBRARY_PATH="$extralib" LD_LIBRARY_PATH="$extralib" cabal copy --destdir=$destdir tar -C $destdir/$prefix -zcf $targz . echo "Created $targz, consider renaming it to something more user friendly" diff --git a/src/runtime/python/setup.py b/src/runtime/python/setup.py index cac6f7409..19459b411 100644 --- a/src/runtime/python/setup.py +++ b/src/runtime/python/setup.py @@ -1,8 +1,18 @@ from distutils.core import setup, Extension +import os + +includes = os.getenv('EXTRA_INCLUDE_DIRS','').split(':') +if includes==['']: + includes=[] +libraries = os.getenv('EXTRA_LIB_DIRS','').split(':') +if libraries==['']: + libraries=[] pgf_module = Extension('pgf', sources = ['pypgf.c'], extra_compile_args = ['-std=c99'], + include_dirs = includes, + library_dirs = libraries, libraries = ['gu', 'pgf']) setup (name = 'pgf',