Skip to content

Commit

Permalink
macOS deps update: Added pcre2, bumped gettext and glib2, removed sta…
Browse files Browse the repository at this point in the history
…tic libs + some cleanup (openscad#5452)

* Added pcre2, bumped gettext and glib2

* Remove static builds, and remove unused libraries
  • Loading branch information
kintel authored Nov 27, 2024
1 parent b550957 commit 40a58a6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
# Pick up our own Qt
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
# Build universal binaries and limit to 30 minutes
./scripts/macosx-build-dependencies.sh -l 30 -x -a -d double_conversion eigen gmp mpfr glew gettext libffi freetype ragel harfbuzz libzip libxml2 libuuid fontconfig hidapi lib3mf pixman cairo glib2 boost cgal qt5 opencsg qscintilla sparkle onetbb
./scripts/macosx-build-dependencies.sh -l 30 -x -a -d
- run:
name: Package Dependencies as an artifact
command: |
Expand Down
87 changes: 28 additions & 59 deletions scripts/macosx-build-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,16 @@ PACKAGES=(
"eigen 3.4.0"
"gmp 6.3.0"
"mpfr 4.2.0"
"glew 2.2.0"
"gettext 0.21.1"
"libffi REMOVE"
"gettext 0.22.5"
"freetype 2.12.1"
"ragel REMOVE"
"harfbuzz 6.0.0"

"libzip 1.9.2"
"libxml2 REMOVE"
"libuuid REMOVE"
"fontconfig 2.14.1"
"hidapi 0.12.0"
"lib3mf 2.3.1"
"glib2 2.81.0"
"pcre2 10.44"
"glib2 2.83.0"
"pixman 0.42.2"
"cairo 1.18.0"
"cgal 6.0"
Expand Down Expand Up @@ -208,7 +204,7 @@ build_qt5()
for arch in ${ARCHS[*]}; do
mkdir build-$arch
cd build-$arch
../configure -prefix $DEPLOYDIR -release -opensource -confirm-license \
../configure -prefix $DEPLOYDIR -release -no-static -opensource -confirm-license \
-nomake examples -nomake tests \
-no-xcb -no-glib -no-harfbuzz -no-cups \
-skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
Expand Down Expand Up @@ -281,7 +277,7 @@ build_gmp()
for arch in ${ARCHS[*]}; do
mkdir build-$arch
cd build-$arch
M4=gm4 ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --enable-cxx --build=$LOCAL_ARCH-apple-darwin --host=$arch-apple-darwin17.0.0
M4=gm4 ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --enable-cxx --disable-static --build=$LOCAL_ARCH-apple-darwin --host=$arch-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down Expand Up @@ -322,7 +318,7 @@ build_mpfr()
arch=${ARCHS[$i]}
mkdir build-$arch
cd build-$arch
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --build=$LOCAL_GNU_ARCH-apple-darwin --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --disable-static --build=$LOCAL_GNU_ARCH-apple-darwin --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down Expand Up @@ -360,7 +356,7 @@ build_boost()
done

./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,chrono,system,regex,date_time,atomic
./b2 -j"$NUMCPU" -d+2 $BOOST_TOOLSET cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]}" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]} -headerpad_max_install_names" install
./b2 -j"$NUMCPU" -d+2 $BOOST_TOOLSET link=shared cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]}" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]} -headerpad_max_install_names" install
}

build_cgal()
Expand Down Expand Up @@ -397,24 +393,6 @@ build_onetbb()
make -j"$NUMCPU" install
}

build_glew()
{
version=$1
cd $BASEDIR/src
rm -rf glew-$version
if [ ! -f glew-$version.tgz ]; then
curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz
fi
tar xzf glew-$version.tgz
cd glew-$version
mkdir -p $DEPLOYDIR/lib/pkgconfig
ARCH_FLAGS=()
for arch in ${ARCHS[*]}; do
ARCH_FLAGS+=(-arch $arch)
done
make GLEW_PREFIX=$DEPLOYDIR GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]}" LDFLAGS.EXTRA="-install_name @rpath/libGLEW.dylib -mmacosx-version-min=$MAC_OSX_VERSION_MIN ${ARCH_FLAGS[*]}" POPT="-Os" STRIP= install
}

build_opencsg()
{
version=$1
Expand Down Expand Up @@ -516,7 +494,7 @@ build_freetype()
arch=${ARCHS[$i]}
mkdir build-$arch
cd build-$arch
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --without-png --without-harfbuzz --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --without-png --without-harfbuzz --disable-static --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down Expand Up @@ -554,19 +532,6 @@ build_libzip()
install_name_tool -id @rpath/libzip.dylib $DEPLOYDIR/lib/libzip.dylib
}

remove_libxml2()
{
echo "Removing libxml2..."
find $DEPLOYDIR -name "*libxml*" -prune -exec rm -rf {} \;
}

remove_libuuid()
{
echo "Removing libuuid..."
find $DEPLOYDIR -name "*libuuid*" -prune -exec rm -rf {} \;
rm -f $DEPLOYDIR/include/uuid.h $DEPLOYDIR/lib/pkgconfig/uuid.pc
}

build_fontconfig()
{
version=$1
Expand Down Expand Up @@ -606,12 +571,6 @@ build_fontconfig()
install_name_tool -id @rpath/libfontconfig.dylib $DEPLOYDIR/lib/libfontconfig.dylib
}

remove_libffi()
{
echo "Removing libffi..."
find $DEPLOYDIR -type f -name "ffi*" -o -name "libffi*" -exec rm -f {} \;
}

build_gettext()
{
version="$1"
Expand Down Expand Up @@ -647,6 +606,22 @@ build_gettext()
fi
}

build_pcre2()
{
version=$1
cd "$BASEDIR"/src
rm -rf "pcre2-$version"
if [ ! -f "pcre2-$version.tar.bz2" ]; then
curl -LO "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$version/pcre2-$version.tar.bz2"
fi
tar xzf "pcre2-$version.tar.bz2"
cd "pcre2-$version"

cmake . -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="$ARCHS_COMBINED"
make -j"$NUMCPU" install
make install
}

build_glib2()
{
version="$1"
Expand All @@ -662,7 +637,7 @@ build_glib2()
# Build each arch separately
for arch in ${ARCHS[*]}; do
sed -e "s,@MAC_OSX_VERSION_MIN@,$MAC_OSX_VERSION_MIN,g" -e "s,@DEPLOYDIR@,$DEPLOYDIR,g" $OPENSCADDIR/scripts/macos-$arch.txt.in > macos-$arch.txt
meson setup --prefix $DEPLOYDIR --cross-file macos-$arch.txt --force-fallback-for libpcre2-8 -Ddocumentation=false -Dman-pages=disabled -Ddtrace=false -Dtests=false build-$arch
meson setup --prefix $DEPLOYDIR --cross-file macos-$arch.txt -Ddocumentation=false -Dman-pages=disabled -Ddtrace=disabled -Dtests=false build-$arch
meson compile -C build-$arch
DESTDIR=install/ meson install -C build-$arch
done
Expand All @@ -682,12 +657,6 @@ build_glib2()
install_name_tool -id @rpath/libglib-2.0.dylib $DEPLOYDIR/lib/libglib-2.0.dylib
}

remove_ragel()
{
echo "Removing ragel..."
find $DEPLOYDIR -type f -name "ragel*" -exec rm -f {} \;
}

build_harfbuzz()
{
version=$1
Expand All @@ -704,7 +673,7 @@ build_harfbuzz()
arch=${ARCHS[$i]}
mkdir build-$arch
cd build-$arch
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" CXXFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --with-freetype=yes --with-gobject=no --with-cairo=no --with-icu=no --with-coretext=auto --with-glib=no --disable-gtk-doc-html --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" CXXFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --with-freetype=yes --with-gobject=no --with-cairo=no --with-icu=no --with-coretext=auto --with-glib=no --disable-gtk-doc-html --disable-static --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down Expand Up @@ -741,7 +710,7 @@ build_hidapi()
arch=${ARCHS[$i]}
mkdir build-$arch
cd build-$arch
../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --disable-static --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down Expand Up @@ -799,7 +768,7 @@ build_pixman()
# libpng is only used for tests, disabling to kill linker warnings since we don't build libpng ourselves
# --disable-arm-a64-neon is due to https://gitlab.freedesktop.org/pixman/pixman/-/issues/59 and
# https://gitlab.freedesktop.org/pixman/pixman/-/issues/69
../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --disable-gtk --disable-libpng --disable-arm-a64-neon --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
../configure --prefix=$DEPLOYDIR CFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="-arch $arch -mmacos-version-min=$MAC_OSX_VERSION_MIN" --disable-gtk --disable-libpng --disable-arm-a64-neon --disable-static --host=${GNU_ARCHS[$i]}-apple-darwin17.0.0
make -j"$NUMCPU" install DESTDIR=$PWD/install/
cd ..
done
Expand Down

0 comments on commit 40a58a6

Please sign in to comment.