Skip to content

Building OSX X86_64 Third Party Dependencies

Pablo Tesone edited this page May 3, 2023 · 9 revisions

Note: Replace /Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ with the path to use as fakeroot during the building. So the building does not affect the building system and performs a clean build.

SDL2-2.0.18

wget https://libsdl.org/release/SDL2-2.0.18.tar.gz

tar xvfz SDL2-2.0.18.tar.gz
cd SDL2-2.0.18

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ 

make install

cd ../lib

install_name_tool -id @executable_path/Plugins/libSDL2-2.0.0.dylib libSDL2-2.0.0.dylib

zip -y SDL2-2.0.18.zip libSDL2*.dylib

SDL2-2.24.1

wget https://libsdl.org/release/SDL2-2.24.1.tar.gz

tar xvfz SDL2-2.24.1.tar.gz
cd SDL2-2.24.1

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ 

make install

cd ../lib

install_name_tool -id @executable_path/Plugins/libSDL2-2.0.0.dylib libSDL2-2.0.0.dylib

zip -y SDL2-2.24.1.zip libSDL2*.dylib

libpng-1.6.37

wget https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
tar xvfz libpng-1.6.37.tar.gz
cd libpng-1.6.37

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
cmake . -DCMAKE_PREFIX_PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ -DCMAKE_INSTALL_PREFIX:PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/

make install

cd ../lib

install_name_tool -id @executable_path/Plugins/libpng16.16.dylib libpng16.16.37.0.dylib

zip -y libpng-1.6.37.zip libpng*.dylib

freetype-2.10.0

wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz
tar xvfz freetype-2.10.0.tar.gz
cd freetype-2.10.0

mkdir build
cd build

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" cmake .. \
 -DBUILD_SHARED_LIBS:BOOL=true \
 -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE \
 -DCMAKE_PREFIX_PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ \
 -DCMAKE_INSTALL_PREFIX:PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/

make install

cd ../lib

install_name_tool -id @executable_path/Plugins/libfreetype.6.dylib libfreetype.6.16.0.dylib
install_name_tool -change @rpath/libpng16.16.dylib @executable_path/Plugins/libpng16.16.dylib libfreetype.6.16.0.dylib

zip -y freetype-2.10.0.zip libfreetype.*dylib

freetype-2.12.1

wget https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz
tar xvfz freetype-2.12.1.tar.gz
cd freetype-2.12.1

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ --enable-freetype-config --without-harfbuzz --without-brotli

make install

install_name_tool -id @executable_path/Plugins/libfreetype.6.dylib libfreetype.6.dylib
install_name_tool -change @rpath/libpng16.16.dylib @executable_path/Plugins/libpng16.16.dylib libfreetype.6.dylib

zip -y freetype-2.12.1.zip libfreetype.*dylib

fontconfig-2.13.1

wget https://freedesktop.org/software/fontconfig/release/fontconfig-2.13.1.tar.gz
tar xvfz fontconfig-2.13.1.tar.gz
cd fontconfig-2.13.1

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
FREETYPE_CFLAGS="-I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include/freetype2" \
FREETYPE_LIBS="-L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib -lfreetype" \
./configure \
--prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ 

make install

cd ../lib

install_name_tool -id @executable_path/Plugins/libfontconfig.1.dylib libfontconfig.1.dylib

zip -y fontconfig-2.13.1.zip libfontconfig*.dylib

pixman-0.40.0

wget https://www.cairographics.org/releases/pixman-0.40.0.tar.gz
tar xvfz pixman-0.40.0.tar.gz

cd pixman-0.40.0

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ 

make install

cd ../lib
install_name_tool -id @executable_path/Plugins/libpixman-1.0.dylib libpixman-1.0.40.0.dylib

zip -y pixman-0.40.0.zip libpixman*.dylib

cairo-1.16.0

wget https://cairographics.org/snapshots/cairo-1.16.0.tar.xz
tar xvf cairo-1.16.0.tar.xz
cd cairo-1.16.0

FONTCONFIG_LIBS="-L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib -lfontconfig" \
FONTCONFIG_CFLAGS="-I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include/fontconfig" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability -I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include" \
LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks -L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ --disable-xlib --disable-xcb

make install

cd ../lib
install_name_tool -id @executable_path/Plugins/libcairo.2.dylib libcairo.2.dylib

zip -y cairo-1.16.0.zip libcairo.*dylib

cairo-1.17.4

wget https://cairographics.org/snapshots/cairo-1.17.4.tar.xz
tar xvf cairo-1.17.4.tar.xz
cd cairo-1.17.4

FONTCONFIG_LIBS="-L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib -lfontconfig" \
FONTCONFIG_CFLAGS="-I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include/fontconfig" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability -I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include" \
LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks -L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
./configure --prefix=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ --disable-xlib --disable-xcb

make install

cd ../lib
install_name_tool -id @executable_path/Plugins/libcairo.2.dylib libcairo.2.dylib
install_name_tool -change @rpath/libpng16.16.dylib @executable_path/Plugins/libpng16.16.dylib libcairo.2.dylib

zip -y cairo-1.17.4.zip libcairo.*dylib

harfbuzz-5.3.1

HARFBUZZ_VERSION=5.3.1
HARFBUZZ_FILENAME=harfbuzz-${HARFBUZZ_VERSION}
BUILD_DIR=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/

wget https://github.com/harfbuzz/harfbuzz/releases/download/${HARFBUZZ_VERSION}/${HARFBUZZ_FILENAME}.tar.xz

tar xvf ${HARFBUZZ_FILENAME}.tar.xz

cd ${HARFBUZZ_FILENAME}

LDFLAGS="-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks" \
CFLAGS="-mmacosx-version-min=10.14 -Werror=partial-availability" \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib/pkgconfig" \
FREETYPE_CFLAGS="-I/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/include/freetype2" \
FREETYPE_LIBS="-L/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib -lfreetype" \
./configure --prefix=${BUILD_DIR} --with-glib=no --with-icu-no

make install
cd ..

install_name_tool -id @executable_path/Plugins/libharfbuzz.0.dylib libharfbuzz.0.dylib

zip -y harfbuzz-5.3.1.zip libharfbuzz.*dylib

libssh2-1.9.0

git clone git@github.com:libssh2/libssh2.git
cd libssh2
git checkout libssh2-1.9.0 
cd ..


cmake . -DCMAKE_INSTALL_PREFIX:PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64 -DCMAKE_PREFIX_PATH=/Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/ -DBUILD_SHARED_LIBS=ON
make install

install_name_tool -id @executable_path/Plugins/libssh2.1.0.1.dylib libssh2.1.0.1.dylib

libgit2-1.4.4

git clone git@github.com:libgit2/libgit2.git
cd libgit2
git checkout v1.4.4 
cd ..

cmake -S libgit2 -B buildLibgit2 -DUSE_SSH=ON -DCMAKE_INSTALL_PREFIX:PATH=`pwd` -DCMAKE_PREFIX_PATH="`pwd`"
cmake --build buildLibgit2 --target install

cd lib
install_name_tool -id @executable_path/Plugins/libgit2.1.4.4.dylib libgit2.1.4.4.dylib
install_name_tool -change libssh2.1.dylib @executable_path/Plugins/libssh2.1.dylib libgit2.1.4.4.dylib

Build Bundles

cd /Users/admin/dev/Pharo/thirdparty/Darwin-x86_64/lib

zip -y libssh2-1.9.0.zip libssh*dylib
zip -y libgit2-1.4.4.zip libgit2*dylib

openssl-1.1.1k

Download sources

mkdir ssl
cd ssl
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar -xvf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k

Compile

CFLAGS="-mmacosx-version-min=10.7" ./config --prefix=${BUILD_DIR}/ && make install

Fix RPaths and package zip

install_name_tool -id @executable_path/Plugins/libcrypto.1.1.dylib libcrypto.1.1.dylib

install_name_tool -id @executable_path/Plugins/libssl.1.1.dylib libssl.1.1.dylib
install_name_tool -change ${BUILD_DIR}/lib/libcrypto.1.1.dylib @executable_path/Plugins/libcrypto.1.1.dylib libssl.1.1.dylib

zip -y openssl-1.1.1k.zip libssl*dylib
zip -y openssl-1.1.1k.zip libcry*dylib

Check with otool -L

otool -L libssl.1.1.dylib
libssl.1.1.dylib:
	@executable_path/Plugins/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@executable_path/Plugins/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

libssh2-1.10.0

Download Sources

git clone https://github.com/libssh2/libssh2.git
cd libssh2
git checkout libssh2-1.10.0 

Compile

mkdir build
cd build

CFLAGS="-mmacosx-version-min=10.7" PKG_CONFIG_PATH="${BUILD_DIR}/lib/pkgconfig" \
cmake .. \
-B . \
-DCMAKE_PREFIX_PATH=${BUILD_DIR} \
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
-DCRYPTO_BACKEND=OpenSSL \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_ZLIB_COMPRESSION=ON

cmake --build .
cmake --build . --target install

Fix RPaths and package zip

install_name_tool -id @executable_path/Plugins/libssh2.1.0.1.dylib libssh2.1.0.1.dylib

zip -y libssh2-1.10.0.zip libssh*dylib

Check with otool -L

otool -L libssh2.dylib
libssh2.dylib:
	@executable_path/Plugins/libssh2.1.0.1.dylib (compatibility version 1.0.0, current version 1.0.1)
	@executable_path/Plugins/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@executable_path/Plugins/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

libgit2-1.5.2

Download Sources

git clone https://github.com/libgit2/libgit2.git
cd libgit2
git checkout v1.5.2 

Compile

mkdir build
cd build 

CFLAGS="-mmacosx-version-min=10.7" PKG_CONFIG_PATH="${BUILD_DIR}/lib/pkgconfig" \
cmake .. -B . \
-DCMAKE_PREFIX_PATH=${BUILD_DIR} \
-DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR} \
-DCMAKE_FIND_ROOT_PATH=${BUILD_DIR} \
-DCMAKE_LIBRARY_PATH=${BUILD_DIR}/lib \
-DCMAKE_INCLUDE_PATH=${BUILD_DIR}/include \
-DUSE_SSH=ON \
-DBUILD_EXAMPLES=ON 

cmake --build . --target install

Fix RPaths and package zip

install_name_tool -id @executable_path/Plugins/libgit2.1.5.2.dylib libgit2.1.5.2.dylib

zip -y libgit2-1.5.2.zip libgit2.1.5.2.dylib
zip -y libgit2-1.5.2.zip libgit2.1.5.dylib
zip -y libgit2-default-2023-04-14.zip libgit2.dylib

libgit2-1.6.4

Download Sources

git clone git@github.com:libgit2/libgit2.git
cd libgit2
git checkout v1.6.4 

Compile

mkdir build1.6.4
cd build1.6.4 

CFLAGS="-mmacosx-version-min=10.7" PKG_CONFIG_PATH="${BUILD_DIR}/lib/pkgconfig" \
cmake .. -B . \
-DCMAKE_PREFIX_PATH=${BUILD_DIR} \
-DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR} \
-DCMAKE_FIND_ROOT_PATH=${BUILD_DIR} \
-DCMAKE_LIBRARY_PATH=${BUILD_DIR}/lib \
-DCMAKE_INCLUDE_PATH=${BUILD_DIR}/include \
-DUSE_SSH=ON \
-DBUILD_EXAMPLES=ON 

cmake --build . --target install

Fix RPaths and package zip

install_name_tool -id @executable_path/Plugins/libgit2.1.6.4.dylib libgit2.1.6.4.dylib

zip -y libgit2-1.6.4.zip libgit2.1.6.4.dylib
zip -y libgit2-1.6.4.zip libgit2.1.6.dylib
Clone this wiki locally