I'm only learning to do this stuff, not an expert!
Pharo has FFI bindings to freetype, cairo and SDL. Such bindings talk to dynamic libraries depending on the running platform:
- Tha Mac VM provides dylibs for all of them.
- The Win VM provides dlls. Must CHECK
- The Linux VM does provide a .so for SDL, but doesn't for freetype and cairo. In such cases, Pharo looks at system's shared libraries.
The following steps work on Mac, but had issues on Linux (an Ubuntu 22.04). See inlined comments.
- Change directory to a temporary location such as
/tmp/pharoVmLibs
- Set a build
BUILD_DIR
env variable where the libraries will be installed, for example:
BUILD_DIR=/tmp/pharoVmLib/build
- Execute next script:
# png uses zlib
ZLIB_FILENAME=zlib-1.2.12
wget https://zlib.net/${ZLIB_FILENAME}.tar.gz
tar xvf ${ZLIB_FILENAME}.tar.gz
cd ${ZLIB_FILENAME}
./configure --prefix=${BUILD_DIR}
make install
cd ..
# freetype uses png (bitmap fonts such as emojis)
LIBPNG_FILENAME=libpng-1.6.37
wget https://download.sourceforge.net/libpng/${LIBPNG_FILENAME}.tar.gz
tar xvf ${LIBPNG_FILENAME}.tar.gz
cd ${LIBPNG_FILENAME}
# PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${BUILD_DIR}/lib/pkgconfig" cmake . -DCMAKE_PREFIX_PATH=${BUILD_DIR}/ -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/
./configure --prefix=${BUILD_DIR}
make install
cd ..
FT_FILENAME=freetype-2.12.1
wget https://download.savannah.gnu.org/releases/freetype/${FT_FILENAME}.tar.gz
tar xvf ${FT_FILENAME}.tar.gz
cd ${FT_FILENAME}
./configure --prefix=${BUILD_DIR}
make install
cd ..
# cairo uses pixman
PIXMAN_FILENAME=pixman-0.40.0
wget https://www.cairographics.org/releases/${PIXMAN_FILENAME}.tar.gz
tar xvf ${PIXMAN_FILENAME}.tar.gz
cd ${PIXMAN_FILENAME}
./configure --prefix=${BUILD_DIR}
make install
cd ..
CAIRO_FILENAME=cairo-1.17.4
wget https://www.cairographics.org/snapshots/${CAIRO_FILENAME}.tar.xz
tar xvf ${CAIRO_FILENAME}.tar.xz
cd ${CAIRO_FILENAME}
# Disable platform-specific backends that Pharo vindings do not use
./configure --prefix=${BUILD_DIR} --disable-fc --disable-xlib --disable-xcb
make install
cd ..
#
# TO BE FIXED (linux):
# ldd ${BUILD_DIR}/lib/libcairo.so
# --> it links the new libcairo to system's pixman, freetype, png and libz.
# ----> It should link to the libs in ${BUILD_DIR}
#
# this build is independent of previous builds
SDL_VERSION=2.0.22
wget https://libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz
tar xvf SDL2-${SDL_VERSION}.tar.gz
cd SDL2-${SDL_VERSION}
./configure --prefix=${BUILD_DIR}/
make install
cd ..
#
# Question (linux): Why is it so different the result of:
# ldd ${BUILD_DIR}/lib/libSDL2.so
# versus:
# ldd /lib/x86_64-linux-gnu/libSDL2-2.0.so
# and is it a problem?
#
- Change to the
Plugins
directory of a VM - Ensure
BUILD_DIR
env var is set, and execute:
//TO DO: add libSDL2 and test
for LIB_PREFIX in libfreetype libpixman- libz libpng libcairo.
do
echo
echo --- Updating ${LIB_PREFIX} ---
echo
echo Removing:
echo
rm -v ${LIB_PREFIX}*dylib
cp -a ${BUILD_DIR}/lib/${LIB_PREFIX}*dylib .
echo
echo Copying:
echo
ls -lah ${LIB_PREFIX}*dylib
done
- Change to the
libs
directory of a VM - Ensure
BUILD_DIR
env var is set, and execute:
for LIB_PREFIX in libfreetype libpixman libz libpng libcairo libSDL2
do
echo
echo --- Updating ${LIB_PREFIX} ---
echo
echo Removing:
echo
rm -v ${LIB_PREFIX}*so*
cp -a ${BUILD_DIR}/lib/${LIB_PREFIX}*so* .
echo
echo Copying:
echo
ls -lah ${LIB_PREFIX}*so*
done
// TO DO