Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Compile freetype with harfbuzz, reduce manylinux wheelsize#3445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
illume merged 3 commits intomainfromankith26-freetype-harfbuzz
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletionsbuildconfig/macdependencies/build_mac_deps.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,18 @@ export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# for great speed.
export MAKEFLAGS="-j 4"

# With this we
# 1) Force install prefix to /usr/local
# 2) use lib directory within /usr/local (and not lib64)
# 3) make release binaries
# 4) build shared libraries
# 5) not have @rpath in the linked dylibs (needed on macs only)
export PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/ \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=true \
-DCMAKE_INSTALL_NAME_DIR=/usr/local/lib"

if [[ "$MAC_ARCH" == "arm64" ]]; then
# for scripts using ./configure to make arm64 binaries
export CC="clang -target arm64-apple-macos11.0"
Expand All@@ -26,7 +38,8 @@ if [[ "$MAC_ARCH" == "arm64" ]]; then
# This does not do anything actually, but without this ./configure errors
export ARCHS_CONFIG_FLAG="--host=aarch64-apple-darwin20.0.0"

export ARCHS_CONFIG_CMAKE_FLAG="-DCMAKE_OSX_ARCHITECTURES=arm64"
# configure cmake to cross-compile
export PG_BASE_CMAKE_FLAGS="$PG_BASE_CMAKE_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64"

# we don't need mac 10.9 support while compiling for apple M1 macs
export MACOSX_DEPLOYMENT_TARGET=11.0
Expand All@@ -37,9 +50,6 @@ else
export MACOSX_DEPLOYMENT_TARGET=10.9
fi

# This arg is added to not have @rpath in the linked dylibs
export ARCHS_CONFIG_CMAKE_FLAG="-DCMAKE_INSTALL_NAME_DIR=/usr/local/lib $ARCHS_CONFIG_CMAKE_FLAG"

cd ../manylinux-build/docker_base

# Now start installing dependencies
Expand All@@ -49,22 +59,16 @@ sudo mkdir -p /usr/local/man/man1 # the install tries to put something in here
sudo chmod 0777 /usr/local/man/man1 # so that install can put files here
mkdir -p ${MACDEP_CACHE_PREFIX_PATH}/usr/local/man/man1

# freetype dependencies
bash brotli/build-brotli.sh
bash bzip2/build-bzip2.sh

# sdl_image deps
bash zlib-ng/build-zlib-ng.sh
bash libpng/build-png.sh # depends on zlib
bash libjpegturbo/build-jpeg-turbo.sh
bash libtiff/build-tiff.sh
bash libwebp/build-webp.sh

# sdl_ttf deps
# export EXTRA_CONFIG_FREETYPE=--without-harfbuzz
# bash freetype/build-freetype.sh
# bash harfbuzz/build-harfbuzz.sh
# export EXTRA_CONFIG_FREETYPE=
# freetype (also sdl_ttf dep)
bash brotli/build-brotli.sh
bash bzip2/build-bzip2.sh
bash freetype/build-freetype.sh

# sdl_mixer deps
Expand All@@ -78,9 +82,6 @@ bash opus/build-opus.sh # needs libogg (which is a container format)
bash gettext/build-gettext.sh
bash glib/build-glib.sh # depends on gettext
bash sndfile/build-sndfile.sh
sudo mkdir -p /usr/local/lib64 # the install tries to put something in here
sudo chmod 0777 /usr/local/lib64
mkdir -p ${MACDEP_CACHE_PREFIX_PATH}/usr/local/lib64
bash fluidsynth/build-fluidsynth.sh

bash sdl_libs/build-sdl2-libs.sh
Expand Down
30 changes: 22 additions & 8 deletionsbuildconfig/manylinux-build/docker_base/Dockerfile-aarch64
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,15 +21,22 @@ RUN yum install -y zlib-devel libX11-devel\
libXrandr-devel libXinerama-devel libXcomposite-devel mesa-libGLU-devel xz
RUN yum install -y libcap-devel libxkbcommon-devel

# With this we
# 1) Force install prefix to /usr/local
# 2) use lib directory within /usr/local (and not lib64)
# 3) make release binaries
# 4) build shared libraries
ENV PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/ \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=true"

ADD pkg-config /pkg-config_build/
RUN ["bash", "/pkg-config_build/build-pkg-config.sh"]

ADD cmake /cmake_build/
RUN ["bash", "/cmake_build/build-cmake.sh"]

ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["bash", "/bzip2_build/build-bzip2.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand All@@ -45,8 +52,11 @@ RUN ["bash", "/webp_build/build-webp.sh"]
ADD libtiff /libtiff_build/
RUN ["bash", "/libtiff_build/build-tiff.sh"]

#ADD harfbuzz /harfbuzz_build/
#RUN ["bash", "/harfbuzz_build/build-harfbuzz.sh"]
ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["bash", "/bzip2_build/build-bzip2.sh"]

ADD freetype /freetype_build/
RUN ["bash", "/freetype_build/build-freetype.sh"]
Expand DownExpand Up@@ -89,6 +99,10 @@ ENV MAKEFLAGS=
ADD portmidi /portmidi_build/
RUN ["bash", "/portmidi_build/build-portmidi.sh"]

# run strip on built libraries
COPY strip-lib-so-files.sh /tmp/
RUN source /tmp/strip-lib-so-files.sh

ENV base_image=$BASE_IMAGE
RUN echo "$base_image"
RUN echo "$BASE_IMAGE"
30 changes: 22 additions & 8 deletionsbuildconfig/manylinux-build/docker_base/Dockerfile-i686
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,15 +22,22 @@ RUN linux32 yum install -y dbus-devel \
libXrandr-devel libXinerama-devel libXcomposite-devel mesa-libGLU-devel xz
RUN linux32 yum install -y libcap-devel libxkbcommon-devel

# With this we
# 1) Force install prefix to /usr/local
# 2) use lib directory within /usr/local (and not lib64)
# 3) make release binaries
# 4) build shared libraries
ENV PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/ \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=true"

ADD pkg-config /pkg-config_build/
RUN ["linux32", "bash", "/pkg-config_build/build-pkg-config.sh"]

ADD cmake /cmake_build/
RUN ["linux32", "bash", "/cmake_build/build-cmake.sh"]

ADD brotli /brotli_build/
RUN ["linux32", "bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["linux32", "bash", "/bzip2_build/build-bzip2.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["linux32", "bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand All@@ -46,8 +53,11 @@ RUN ["linux32", "bash", "/webp_build/build-webp.sh"]
ADD libtiff /libtiff_build/
RUN ["linux32", "bash", "/libtiff_build/build-tiff.sh"]

#ADD harfbuzz /harfbuzz_build/
#RUN ["linux32", "bash", "/harfbuzz_build/build-harfbuzz.sh"]
ADD brotli /brotli_build/
RUN ["linux32", "bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["linux32", "bash", "/bzip2_build/build-bzip2.sh"]

ADD freetype /freetype_build/
RUN ["linux32", "bash", "/freetype_build/build-freetype.sh"]
Expand DownExpand Up@@ -90,3 +100,7 @@ ENV MAKEFLAGS=

ADD portmidi /portmidi_build/
RUN ["linux32", "bash", "/portmidi_build/build-portmidi.sh"]

# run strip on built libraries
COPY strip-lib-so-files.sh /tmp/
RUN source /tmp/strip-lib-so-files.sh
30 changes: 22 additions & 8 deletionsbuildconfig/manylinux-build/docker_base/Dockerfile-x86_64
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,15 +21,22 @@ RUN yum install -y zlib-devel libX11-devel\
libXrandr-devel libXinerama-devel libXcomposite-devel mesa-libGLU-devel xz
RUN yum install -y libcap-devel libxkbcommon-devel

# With this we
# 1) Force install prefix to /usr/local
# 2) use lib directory within /usr/local (and not lib64)
# 3) make release binaries
# 4) build shared libraries
ENV PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/ \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=true"

ADD pkg-config /pkg-config_build/
RUN ["bash", "/pkg-config_build/build-pkg-config.sh"]

ADD cmake /cmake_build/
RUN ["bash", "/cmake_build/build-cmake.sh"]

ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["bash", "/bzip2_build/build-bzip2.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand All@@ -45,8 +52,11 @@ RUN ["bash", "/webp_build/build-webp.sh"]
ADD libtiff /libtiff_build/
RUN ["bash", "/libtiff_build/build-tiff.sh"]

#ADD harfbuzz /harfbuzz_build/
#RUN ["bash", "/harfbuzz_build/build-harfbuzz.sh"]
ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

#ADD bzip2 /bzip2_build/
#RUN ["bash", "/bzip2_build/build-bzip2.sh"]

ADD freetype /freetype_build/
RUN ["bash", "/freetype_build/build-freetype.sh"]
Expand DownExpand Up@@ -89,6 +99,10 @@ ENV MAKEFLAGS=
ADD portmidi /portmidi_build/
RUN ["bash", "/portmidi_build/build-portmidi.sh"]

# run strip on built libraries
COPY strip-lib-so-files.sh /tmp/
RUN source /tmp/strip-lib-so-files.sh

ENV base_image=$BASE_IMAGE
RUN echo "$base_image"
RUN echo "$BASE_IMAGE"
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ sha512sum -c alsa.sha512
tar xjf ${ALSA}.tar.bz2
cd ${ALSA}

./configure --with-configdir=/usr/share/alsa
# alsa prefers /usr prefix as a default, so we explicitly override it
./configure --prefix=/usr/local --with-configdir=/usr/local/share/alsa
make
make install
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ sha512sum -c brotli.sha512
tar xzf ${BROTLI}.tar.gz
cd $BROTLI

cmake . $ARCHS_CONFIG_CMAKE_FLAG -DCMAKE_BUILD_TYPE=Release
cmake . $PG_BASE_CMAKE_FLAGS
make
make install

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,19 @@ sha512sum -c fluidsynth.sha512
tar xzf ${FSYNTH}.tar.gz

cd $FSYNTH

# This hack is only needed for fluidsynth 2.2.x and can be removed once
# fluidsynth is updated and https://github.com/FluidSynth/fluidsynth/pull/978
# makes it to a release.
# Currently fluidsynth uses non-standard LIB_INSTALL_DIR instead of
# CMAKE_INSTALL_LIBDIR, but we set the latter.
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -i 's/LIB_INSTALL_DIR/CMAKE_INSTALL_LIBDIR/g' CMakeLists.txt src/CMakeLists.txt
elif [[ "$OSTYPE" == "darwin"* ]]; then
# the -i flag on mac sed expects some kind of suffix (otherwise it errors)
sed -i '' 's/LIB_INSTALL_DIR/CMAKE_INSTALL_LIBDIR/g' CMakeLists.txt src/CMakeLists.txt
fi

mkdir build
cd build

Expand All@@ -19,8 +32,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
export FLUIDSYNTH_EXTRA_MAC_FLAGS="-Denable-framework=NO"
fi

cmake .. -Denable-readline=OFF -DCMAKE_BUILD_TYPE=Release \
$ARCHS_CONFIG_CMAKE_FLAG $FLUIDSYNTH_EXTRA_MAC_FLAGS
cmake .. $PG_BASE_CMAKE_FLAGS -Denable-readline=OFF $FLUIDSYNTH_EXTRA_MAC_FLAGS
make
make install

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,17 +4,60 @@ set -e -x
cd $(dirname `readlink -f "$0"`)

FREETYPE=freetype-2.12.1
HARFBUZZ_VER=5.1.0
HARFBUZZ_NAME="harfbuzz-$HARFBUZZ_VER"

if [ ! -d $FREETYPE ]; then
curl -sL --retry 10 http://download.savannah.gnu.org/releases/freetype/${FREETYPE}.tar.gz > ${FREETYPE}.tar.gz
curl -sL --retry 10 https://github.com/harfbuzz/harfbuzz/releases/download/${HARFBUZZ_VER}/${HARFBUZZ_NAME}.tar.xz > ${HARFBUZZ_NAME}.tar.xz
sha512sum -c freetype.sha512

curl -sL --retry 10 http://download.savannah.gnu.org/releases/freetype/${FREETYPE}.tar.gz > ${FREETYPE}.tar.gz
sha512sum -c freetype.sha512
# extract installed sources
tar xzf ${FREETYPE}.tar.gz
unxz ${HARFBUZZ_NAME}.tar.xz
tar xf ${HARFBUZZ_NAME}.tar

tar xzf ${FREETYPE}.tar.gz
# freetype and harfbuzz have an infamous circular dependency, which is why
# this file is not like the rest of docker_base files

# 1. First compile freetype without harfbuzz support
cd $FREETYPE

./configure $ARCHS_CONFIG_FLAG --with-harfbuzz=no
make
make install # this freetype is not installed to mac cache dir

cd ..

# 2. Compile harfbuzz with freetype support
cd ${HARFBUZZ_NAME}

# harfbuzz has a load of optional dependencies but only freetype is important
# to us.
# Cairo and chafa are only needed for harfbuzz commandline utilities so we
# don't use it. glib available is a bit old so we don't prefer it as of now.
# we also don't compile-in icu so that harfbuzz uses built-in unicode handling
# LDFLAGS are passed explicitly so that harfbuzz picks the freetype we
# installed first
./configure $ARCHS_CONFIG_FLAG --with-freetype=yes \
--with-cairo=no --with-chafa=no --with-glib=no --with-icu=no \
--disable-static LDFLAGS="-L/usr/local/lib"
make
make install

if [[ "$OSTYPE" == "darwin"* ]]; then
# Install to mac deps cache dir as well
make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH}
fi

cd ..

# 3. Recompile freetype, and this time with harfbuzz support
cd $FREETYPE

./configure $EXTRA_CONFIG_FREETYPE $ARCHS_CONFIG_FLAG
# fully clean previous install
make clean

./configure $ARCHS_CONFIG_FLAG --with-harfbuzz=yes
make
make install

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
4f923c82121940e866022c1ee6afb97f447b83ab8b54188df169029f37589e3bad0768a3bfb3095982804db1eec582f05aa846dfb32639697e231af8d52676cc freetype-2.12.1.tar.gz
452c4236ef997db2a32c5ac32d3b619c5fa9b5691cde935092b32581387de8d161ab1ba78dd9fa02c36ce553f0f1fdd5564132ec81cd7b863af6d3be96cbf979 harfbuzz-5.1.0.tar.xz
View file
Open in desktop

This file was deleted.

View file
Open in desktop

This file was deleted.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,8 +12,7 @@ sha512sum -c libjpegturbo.sha512
tar xzf ${JPEG}.tar.gz
cd ${JPEG}

cmake . $ARCHS_CONFIG_CMAKE_FLAG -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/ -DWITH_TURBOJPEG=0
cmake . $PG_BASE_CMAKE_FLAGS -DWITH_TURBOJPEG=0

make
make install
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
./configure --disable-lzma --disable-webp --disable-zstd
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Use CMake on MacOS because arm64 builds fail with weird errors in ./configure
cmake . $ARCHS_CONFIG_CMAKE_FLAG -DCMAKE_BUILD_TYPE=Release -Dlzma=OFF -Dwebp=OFF -Dzstd=OFF
cmake . $PG_BASE_CMAKE_FLAGS -Dlzma=OFF -Dwebp=OFF -Dzstd=OFF
fi

make
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp