Skip to content

Commit

Permalink
inkscape: rebuild version 1.2.2
Browse files Browse the repository at this point in the history
Rationale:

 - some Python extensions did not work due to missing
   packages

 - Python 3.10 turned out to be problematic, since
   the PyGObjec module loader has problems with this
   version
thomas committed Apr 20, 2023
1 parent 3947293 commit bd79fc3
Showing 1 changed file with 233 additions and 0 deletions.
233 changes: 233 additions & 0 deletions inkscape-1.2.2-1.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
#! /bin/sh

# COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh
# TESTING=1

set -xe

PKG=inkscape
VERSION=1.2.2
BUILD=1
DATEREV=2022-12-01_b0a8486541 # The hex part is now called 'revision'

PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi

PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.$USER.build.tmp
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home

mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi
EOF

source $PREFIX/profile

export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
mkdir -p $PREFIX/build
cd $PREFIX/build

NPROC=$(( $(nproc) * 4 / 5 + 1 ))

BEEHIVE=https://beehive.molgen.mpg.de/0bbd38f12656e4728e2f7c4708aec014/gdbm-1.22.tar.gz
test -e gdbm-1.22.tar.gz || wget -nv $BEEHIVE
test -d gdbm-1.22 || tar -xf gdbm-1.22.tar.gz
cd gdbm-1.22

CFLAGS="-O2 -fPIC" ./configure \
--prefix=$PREFIX \
--enable-libgdbm-compat

make -j $NPROC
make install
cd ..

PYTHONVERSION=3.9.16
PYTHONVERMAIN=${PYTHONVERSION%.*}
BEEHIVE=https://beehive.molgen.mpg.de/38c99c7313f416dcf3238f5cf444c6c2/Python-3.9.16.tgz
test -e Python-$PYTHONVERSION.tgz || wget -nv $BEEHIVE
test -d Python-$PYTHONVERSION || tar -xf Python-$PYTHONVERSION.tgz
cd Python-$PYTHONVERSION

LDFLAGS="-Wl,-rpath=$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--enable-shared

make -j $NPROC
make install
pip3 install --upgrade pip
pip3 install Cython
pip3 install lxml
pip3 install numpy
pip3 install scour
pip3 install serial
pip3 install pytest

pip3 install cssselect
pip3 install requests
pip3 install appdirs

# provide 'python' symlink, or boost will insist on the system python ...
test -e $PREFIX/bin/python || ln -s python3 $PREFIX/bin/python

cd ..

(
DBUS_PYTHON_VERSION=1.3.2

# https://files.pythonhosted.org/packages/c1/d3/6be85a9c772d6ebba0cc3ab37390dd6620006dcced758667e0217fb13307/dbus-python-1.3.2.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/33be8a4a766e1c7c9a377b8f934ce21a/dbus-python-1.3.2.tar.gz
test -e dbus-python-$DBUS_PYTHON_VERSION.tar.gz || wget -nv $BEEHIVE
test -d dbus-python-$DBUS_PYTHON_VERSION || tar -xf dbus-python-$DBUS_PYTHON_VERSION.tar.gz

cd dbus-python-$DBUS_PYTHON_VERSION
./configure --prefix=$PREFIX

make -j $NPROC
make install

)

(
PYCAIRO_VERSION=1.23.0

# https://files.pythonhosted.org/packages/69/ca/9e9fa2e8be0876a9bbf046a1be7ee33e61d4fdfbd1fd25c76c1bdfddf8c4/pycairo-1.23.0.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/7a3729d21659098e1b9a411b62e88966/pycairo-1.23.0.tar.gz
test -e pycairo-$PYCAIRO_VERSION.tar.gz || wget -nv $BEEHIVE
test -d pycairo-$PYCAIRO_VERSION || tar -xf pycairo-$PYCAIRO_VERSION.tar.gz

cd pycairo-$PYCAIRO_VERSION

mkdir -p meson-build
cd meson-build

meson setup \
--prefix=$PREFIX \
--buildtype=release \
-Dpython=$PREFIX/bin/python \
-Dtests=false \
..

ninja -j $NPROC
ninja install

)

(
PYGOBJECT3_VERSION=3.44.1

# https://files.pythonhosted.org/packages/44/80/96d6317a15a13a4f80ffa61118dc144a70756135fbc6ace30f9b033f51f7/PyGObject-3.44.1.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/959259478566b24316edaa18da6e0eaa/PyGObject-3.44.1.tar.gz

test -e PyGObject-$PYGOBJECT3_VERSION.tar.gz || wget -nv $BEEHIVE
test -d PyGObject-$PYGOBJECT3_VERSION || tar -xf PyGObject-$PYGOBJECT3_VERSION.tar.gz

cd PyGObject-$PYGOBJECT3_VERSION

mkdir -p meson-build
cd meson-build
meson setup \
--prefix=$PREFIX \
--buildtype=release \
-Dpython=$PREFIX/bin/python \
-Dtests=false \
..

ninja -j $NPROC
ninja install

)

BOOSTVERSION=1.75.0
BOOSTVERSION_USCORED=1_75_0
PKGCFLAGS="-O2 -fPIC"

BEEHIVE=https://beehive.molgen.mpg.de//38813f6feb40387dfe90160debd71251/boost_1_75_0.tar.gz
test -e boost_$BOOSTVERSION_USCORED.tar.gz || wget -nv $BEEHIVE
test -d boost_$BOOSTVERSION_USCORED || tar -xf boost_$BOOSTVERSION_USCORED.tar.gz
cd boost_$BOOSTVERSION_USCORED

sed -e "/using python/ s|;|: ${PREFIX}/include/python${PYTHONVERMAIN} ;|" \
-i bootstrap.sh

./bootstrap.sh \
--with-toolset=gcc \
--with-icu \
--with-python=$PREFIX/bin/python3 \
--with-libraries=filesystem || exit 1

./b2 \
-j $NPROC \
--layout=system \
--build-dir=build-python3 \
--prefix=$PREFIX \
--libdir=$PREFIX/lib \
--build-type=minimal \
toolset=gcc \
variant=release \
debug-symbols=off \
link=shared \
threading=multi \
runtime-link=shared \
python=$PYTHONVERMAIN \
cflags="$PKGCFLAGS" \
cxxflags="$PKGCFLAGS" \
install || exit 1

cd ..

# orig: https://inkscape.org/gallery/item/37360/inkscape-1.2.2.tar.xz
BEEHIVE=https://beehive.molgen.mpg.de/490c40bbb3ce3441ceee88e61775bbf4/inkscape-1.2.2.tar.xz
test -e inkscape-$VERSION.tar.xz || wget -nv $BEEHIVE
test -d inkscape-${VERSION}_$DATEREV || tar -xf inkscape-$VERSION.tar.xz
cd inkscape-${VERSION}_$DATEREV

# remove weird font-feature-settings. (OHOH, this ed cmd is VERY,VERY fragile!)
cp -p share/ui/style.css share/ui/style.css.orig
echo -e "79,81d\nw\nq" | ed share/ui/style.css

# 'fix' some strange issue with the GTK binding in the extensions dialog.
# -> setup method in class ExtensionTreeView. Throws still some errors
# when using, but no longer at startup ...
sed \
-e '/^\s\s*self.ViewColumn/ s/self/# self/' \
-e '/^\s\s*self.ViewSort/ s/self/# self/' \
-e '/^\s\s*# self.ViewSort/ a \ pass' \
-i.orig \
share/extensions/other/inkman/inkman/gui/info.py

mkdir -p build
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
..

make -j $NPROC
make install


# INKSCAPE_INSTALL_LIBDIR=lib does no longer work, now we have:
#
# runtime path bin/inkscape: "$ORIGIN/../lib/inkscape"
# runtime path bin/inkview: "$ORIGIN/../lib/inkscape"
# runtime path lib/inkscape/libinkscape_base.so: "$ORIGIN/.."
#
# therefore clean up the mess by hand ...

cd $PREFIX
mv $PREFIX/lib/inkscape/libinkscape_base.so $PREFIX/lib
rmdir $PREFIX/lib/inkscape
patchelf --set-rpath '$ORIGIN/../lib' bin/inkscape
patchelf --set-rpath '$ORIGIN/../lib' bin/inkview
patchelf --set-rpath '$ORIGIN' lib/libinkscape_base.so

exit

0 comments on commit bd79fc3

Please sign in to comment.