Skip to content

Commit

Permalink
fix python linkage problems
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jul 30, 2020
1 parent ddb25c7 commit 715e990
Show file tree
Hide file tree
Showing 30 changed files with 1,051 additions and 27 deletions.
5 changes: 2 additions & 3 deletions qgis_deps/distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ function python_package_installed() {
push_env
if $PYTHON -c import\ $python_import > /dev/null 2>&1
then
# echo "$1 a"
return 0
fi
pop_env
Expand Down Expand Up @@ -310,10 +309,10 @@ function get_directory() {

function check_linked_rpath() {
cd ${STAGE_PATH}
if otool -L $1 | grep -q /usr/local/lib
if otool -L $1 | grep -q /usr/local
then
otool -L $1
error "$1 contains /usr/local/lib string <-- CMake picked some homebrew libs!"
error "$1 contains /usr/local string <-- CMake picked some homebrew libs!"
fi

# the binaries cannot contain reference to build path since this path is not present when
Expand Down
2 changes: 1 addition & 1 deletion qgis_deps/recipes/boost/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function build_boost() {

# function called after all the compile have been done
function postbuild_boost() {
verify_lib libboost_python${VERSION_major_python//./}.dylib
verify_binary lib/libboost_python${VERSION_major_python//./}.dylib
}

# function to append information to config file
Expand Down
36 changes: 36 additions & 0 deletions qgis_deps/recipes/bz2/Makefile-libbz2_dylib
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SHELL=/bin/sh
CC=clang
BIGFILES=-D_FILE_OFFSET_BITS=64
CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)

OBJS= blocksort.o \
huffman.o \
crctable.o \
randtable.o \
compress.o \
decompress.o \
bzlib.o

all: $(OBJS)
$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS)
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.8 libbz2.so.1.0

clean:
rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared

blocksort.o: blocksort.c
$(CC) $(CFLAGS) -c blocksort.c
huffman.o: huffman.c
$(CC) $(CFLAGS) -c huffman.c
crctable.o: crctable.c
$(CC) $(CFLAGS) -c crctable.c
randtable.o: randtable.c
$(CC) $(CFLAGS) -c randtable.c
compress.o: compress.c
$(CC) $(CFLAGS) -c compress.c
decompress.o: decompress.c
$(CC) $(CFLAGS) -c decompress.c
bzlib.o: bzlib.c
$(CC) $(CFLAGS) -c bzlib.c
76 changes: 76 additions & 0 deletions qgis_deps/recipes/bz2/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

DESC_bz2="Portable Foreign Function Interface library"

# version of your package
VERSION_bz2_major=1.0
VERSION_bz2=$VERSION_bz2_major.8
LINK_bz2=libbz2.$VERSION_bz2_major.dylib

# dependencies of this recipe
DEPS_bz2=()

# url of the package
URL_bz2=https://sourceware.org/pub/bzip2/bzip2-${VERSION_bz2}.tar.gz

# md5 of the package
MD5_bz2=67e051268d0c475ea773822f7500d0e5

# default build path
BUILD_bz2=$BUILD_PATH/bz2/$(get_directory $URL_bz2)

# default recipe path
RECIPE_bz2=$RECIPES_PATH/bz2

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_bz2() {
cd $BUILD_bz2

# check marker
if [ -f .patched ]; then
return
fi

touch .patched
}

function shouldbuild_bz2() {
# If lib is newer than the sourcecode skip build
if [ ${STAGE_PATH}/lib/$LINK_bz2 -nt $BUILD_bz2/.patched ]; then
DO_BUILD=0
fi
}

# function called to build the source code
function build_bz2() {
try rsync -a $BUILD_bz2/ $BUILD_PATH/bz2/build-$ARCH/
try cd $BUILD_PATH/bz2/build-$ARCH
push_env

try $MAKESMP PREFIX=$STAGE_PATH
try $MAKE install PREFIX=$STAGE_PATH

try ${SED} "s;-shared -Wl,-soname -Wl,libbz2.so.$VERSION_bz2_major -o libbz2.so.$VERSION_bz2;-dynamiclib -install_name libbz2.$VERSION_bz2_major.dylib -current_version $VERSION_bz2 -compatibility_version $VERSION_bz2_major -o libbz2.$VERSION_bz2.dylib;g" Makefile-libbz2_so
try ${SED} "s;libbz2.so.$VERSION_bz2;libbz2.$VERSION_bz2.dylib;g" Makefile-libbz2_so
try ${SED} "s;libbz2.so.$VERSION_bz2_major;libbz2.$VERSION_bz2_major.dylib;g" Makefile-libbz2_so

try $MAKESMP PREFIX=$STAGE_PATH -f Makefile-libbz2_so
ln -s libbz2.$VERSION_bz2_major.dylib libbz2.dylib
try cp -av libbz2.*dylib $STAGE_PATH/lib/
try install_name_tool -id $STAGE_PATH/lib/libbz2.$VERSION_bz2_major.dylib $STAGE_PATH/lib/libbz2.$VERSION_bz2_major.dylib

pop_env
}

# function called after all the compile have been done
function postbuild_bz2() {
verify_binary lib/$LINK_bz2
}

# function to append information to config file
function add_config_info_bz2() {
append_to_config_file "# bz2-${VERSION_bz2}: ${DESC_bz2}"
append_to_config_file "export VERSION_bz2=${VERSION_bz2}"
append_to_config_file "export LINK_bz2=${LINK_bz2}"
}
2 changes: 1 addition & 1 deletion qgis_deps/recipes/flex/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function build_flex() {

# function called after all the compile have been done
function postbuild_flex() {
verify_lib "libfl.dylib"
verify_binary "lib/libfl.dylib"
}

# function to append information to config file
Expand Down
87 changes: 87 additions & 0 deletions qgis_deps/recipes/fontconfig/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

DESC_fontconfig="fontconfig"

# version of your package
VERSION_fontconfig=2.13.92

LINK_fontconfig=libfontconfig.1.dylib

# dependencies of this recipe
DEPS_fontconfig=(libtool gettext freetype)

# url of the package
URL_fontconfig=https://www.freedesktop.org/software/fontconfig/release/fontconfig-$VERSION_fontconfig.tar.gz

# md5 of the package
MD5_fontconfig=eda1551685c25c4588da39222142f063

# default build path
BUILD_fontconfig=$BUILD_PATH/fontconfig/$(get_directory $URL_fontconfig)

# default recipe path
RECIPE_fontconfig=$RECIPES_PATH/fontconfig


# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_fontconfig() {
cd $BUILD_fontconfig

# check marker
if [ -f .patched ]; then
return
fi

patch_configure_file configure

touch .patched
}

# function called before build_fontconfig
# set DO_BUILD=0 if you know that it does not require a rebuild
function shouldbuild_fontconfig() {
# If lib is newer than the sourcecode skip build
if [ "${STAGE_PATH}/lib/$LINK_fontconfig" -nt $BUILD_fontconfig/.patched ]; then
DO_BUILD=0
fi
}

# function called to build the source code
function build_fontconfig() {
try rsync -a $BUILD_fontconfig/ $BUILD_PATH/fontconfig/build-$ARCH/
try cd $BUILD_PATH/fontconfig/build-$ARCH

push_env

export LIBTOOLIZE="glibtoolize"
export GETTEXTIZE="ggettextize"
export AUTOPOINT="gautopoint"
export PKG_CONFIG_PATH=$STAGE_PATH/lib/pkgconfig

try ${CONFIGURE}

check_file_configuration config.status

try $MAKESMP
try $MAKE install

unset LIBTOOLIZE
unset GETTEXTIZE
unset AUTOPOINT
unset PKG_CONFIG_PATH

pop_env
}

# function called after all the compile have been done
function postbuild_fontconfig() {
verify_binary lib/$LINK_fontconfig
}

# function to append information to config file
function add_config_info_fontconfig() {
append_to_config_file "# fontconfig-${VERSION_fontconfig}: ${DESC_fontconfig}"
append_to_config_file "export VERSION_fontconfig=${VERSION_fontconfig}"
append_to_config_file "export LINK_fontconfig=${LINK_fontconfig}"
}
72 changes: 72 additions & 0 deletions qgis_deps/recipes/freetype/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

DESC_freetype="Library to extract data from Excel .xls files"

# version of your package
VERSION_freetype=2.10.0
LINK_freetype=libfreetype.6.dylib

# dependencies of this recipe
DEPS_freetype=()

# url of the package
URL_freetype=https://download.savannah.gnu.org/releases/freetype/freetype-$VERSION_freetype.tar.gz

# md5 of the package
MD5_freetype=58d56c9ad775326d6c9c5417c462a527

# default build path
BUILD_freetype=$BUILD_PATH/freetype/$(get_directory $URL_freetype)

# default recipe path
RECIPE_freetype=$RECIPES_PATH/freetype

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_freetype() {
cd $BUILD_freetype

# check marker
if [ -f .patched ]; then
return
fi

patch_configure_file configure

touch .patched
}

function shouldbuild_freetype() {
# If lib is newer than the sourcecode skip build
if [ ${STAGE_PATH}/lib/$LINK_freetype -nt $BUILD_freetype/.patched ]; then
DO_BUILD=0
fi
}

# function called to build the source code
function build_freetype() {
try rsync -a $BUILD_freetype/ $BUILD_PATH/freetype/build-$ARCH/
try cd $BUILD_PATH/freetype/build-$ARCH

push_env

try ${CONFIGURE} --disable-debug

check_file_configuration config.status
try $MAKESMP
try $MAKESMP install

pop_env
}

# function called after all the compile have been done
function postbuild_freetype() {
verify_binary lib/$LINK_freetype
}

# function to append information to config file
function add_config_info_freetype() {
append_to_config_file "# freetype-${VERSION_freetype}: ${DESC_freetype}"
append_to_config_file "export VERSION_freetype=${VERSION_freetype}"
append_to_config_file "export LINK_freetype=${LINK_freetype}"
}
10 changes: 10 additions & 0 deletions qgis_deps/recipes/gdal/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ DESC_gdal="Geospatial Data Abstraction Library"
# keep in SYNC with python_gdal receipt
VERSION_gdal=3.1.2

source $RECIPES_PATH/netcdf/recipe.sh
source $RECIPES_PATH/xerces/recipe.sh

LINK_libgdal_version=27
LINK_gdal=libgdal.$LINK_libgdal_version.dylib

Expand Down Expand Up @@ -78,6 +81,7 @@ function build_gdal() {
--enable-driver-mvt \
--with-pg=yes \
--with-xerces=yes \
--with-pcre=no \
--with-xerces-inc=$STAGE_PATH/include \
--with-xerces-lib="-lxerces-c" \
${WITH_GDAL_DRIVERS} \
Expand All @@ -96,6 +100,12 @@ function build_gdal() {
try $MAKESMP
try $MAKESMP install

# not sure why gdal lib uses RPATH just for netcdf lib?
install_name_tool -change @rpath/$LINK_netcdf ${STAGE_PATH}/lib/$LINK_netcdf $LINK_gdal

# not sure why xerces lib is taken from build dir?
install_name_tool -change $BUILD_PATH/xerces/build-$ARCH/src/$LINK_libxerces_c ${STAGE_PATH}/lib/$LINK_libxerces_c $LINK_gdal

pop_env
}

Expand Down
Loading

0 comments on commit 715e990

Please sign in to comment.