Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Update config for FriBiDi dynamic linking #181

Merged
merged 10 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from 9 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
44 changes: 43 additions & 1 deletion config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARCHIVE_SDIR=pillow-depends-master

# Package versions for fresh source builds
FREETYPE_VERSION=2.10.4
HARFBUZZ_VERSION=2.7.4
nulano marked this conversation as resolved.
Show resolved Hide resolved
LIBPNG_VERSION=1.6.37
ZLIB_VERSION=1.2.11
JPEG_VERSION=9d
Expand All @@ -17,6 +18,21 @@ LIBWEBP_VERSION=1.2.0
BZIP2_VERSION=1.0.8
LIBXCB_VERSION=1.14

# workaround for multibuild bug with .tar.xz
function untar {
local in_fname=$1
if [ -z "$in_fname" ];then echo "in_fname not defined"; exit 1; fi
local extension=${in_fname##*.}
case $extension in
tar) tar -xf $in_fname ;;
gz|tgz) tar -zxf $in_fname ;;
bz2) tar -jxf $in_fname ;;
zip) unzip -qq $in_fname ;;
xz) unxz -c $in_fname | tar -xf - ;;
Copy link
Contributor Author

@nulano nulano Jan 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is wrong in the multibuild version causing an error in tar; https://github.com/matthew-brett/multibuild/pull/380.

*) echo Did not recognize extension $extension; exit 1 ;;
esac
}

function pre_build {
# Any stuff that you need to do before you start building the wheels
# Runs in the root directory of this repository.
Expand Down Expand Up @@ -73,13 +89,34 @@ function pre_build {
build_freetype
fi

if [ -z "$IS_MACOS" ]; then
export FREETYPE_LIBS=-lfreetype
export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
fi
build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--with-glib=no to avoid pulling in unrelated libraries on macos.

if [ -z "$IS_MACOS" ]; then
export FREETYPE_LIBS=''
export FREETYPE_CFLAGS=''
fi

# Append licenses
for filename in dependency_licenses/*; do
echo -e "\n\n----\n\n$(basename $filename | cut -f 1 -d '.')\n" | cat >> Pillow/LICENSE
cat $filename >> Pillow/LICENSE
done
}

function pip_wheel_cmd {
local abs_wheelhouse=$1
if [ -z "$IS_MACOS" ]; then
CFLAGS="$CFLAGS --std=c99" # for Raqm
Copy link
Contributor Author

@nulano nulano Jan 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to compile with C99 than to merge in the (poorly tested) C89 patch from python-pillow/Pillow@b3cfe73, especially when this file is not compiled by default.

fi
pip wheel $(pip_opts) \
--global-option build_ext --global-option --enable-raqm \
--global-option --vendor-raqm --global-option --vendor-fribidi \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overriding pip_wheel_cmd to add the needed global options, as defined in python-pillow/Pillow#5062.

-w $abs_wheelhouse --no-deps .
}

function run_tests_in_repo {
# Run Pillow tests from within source repo
python3 selftest.py
Expand All @@ -92,7 +129,12 @@ if [[ $MACOSX_DEPLOYMENT_TARGET != "11.0" ]]; then
fi
EXP_CODECS="$EXP_CODECS libtiff zlib"
EXP_MODULES="freetype2 littlecms2 pil tkinter webp"
EXP_FEATURES="transp_webp webp_anim webp_mux"
if [ -z "$IS_MACOS" ] && [[ "$MB_PYTHON_VERSION" != pypy3* ]]; then
EXP_FEATURES="fribidi harfbuzz raqm transp_webp webp_anim webp_mux"
else
# can't find FriBiDi
EXP_FEATURES="transp_webp webp_anim webp_mux"
fi
if [[ $MACOSX_DEPLOYMENT_TARGET != "11.0" ]]; then
EXP_FEATURES="$EXP_FEATURES xcb"
fi
Expand Down
38 changes: 38 additions & 0 deletions dependency_licenses/HARFBUZZ.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
HarfBuzz is licensed under the so-called "Old MIT" license. Details follow.
For parts of HarfBuzz that are licensed under different licenses see individual
files names COPYING in subdirectories where applicable.

Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Google, Inc.
Copyright © 2018,2019,2020 Ebrahim Byagowi
Copyright © 2019,2020 Facebook, Inc.
Copyright © 2012 Mozilla Foundation
Copyright © 2011 Codethink Limited
Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
Copyright © 2009 Keith Stribley
Copyright © 2009 Martin Hosken and SIL International
Copyright © 2007 Chris Wilson
Copyright © 2006 Behdad Esfahbod
Copyright © 2005 David Turner
Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc.
Copyright © 1998-2004 David Turner and Werner Lemberg

For full copyright notices consult the individual files in the package.


Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the
above copyright notice and the following two paragraphs appear in
all copies of this software.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
22 changes: 22 additions & 0 deletions dependency_licenses/RAQM.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright © 2015 Information Technology Authority (ITA) <[email protected]>
Copyright © 2016 Khaled Hosny <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.