From dcbdc9b3499b039f0060e6868dd0f852a86a976e Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Wed, 15 Jan 2025 15:44:25 +0100 Subject: [PATCH 01/12] Adding libtiff for leptonica - nail it --- build.profile | 4 ++++ libtiff.build.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 libtiff.build.sh diff --git a/build.profile b/build.profile index bda8c07..f770a8b 100644 --- a/build.profile +++ b/build.profile @@ -53,6 +53,10 @@ BUILD_nginx_SRCURL="https://beehive.molgen.mpg.de/89773c781ff0c2cd876b03bbc094c2 BUILD_libfontttf=liberation-fonts-ttf-2.1.5 BUILD_libfontttf_SRCURL="https://beehive.molgen.mpg.de/31b453e0b77bacde410a34a725b34f8a/${BUILD_libfontttf}.tar.gz" +# SRCURL=""https://download.osgeo.org/libtiff/tiff-4.7.0.tar.gz"/${BUILD_ffmpeg}.tar.gz" +BUILD_libtiff=tiff-4.7.0 +BUILD_libtiff_SRCURL="https://beehive.molgen.mpg.de/3a0fa4a270a4a192b08913f88d0cfbdd/${BUILD_libtiff}.tar.gz" + # gits BUILD_imagemagick=imagemagick-7.1.1-41 BUILD_imagemagick_SRCURL="https://github.com/ImageMagick/ImageMagick.git" diff --git a/libtiff.build.sh b/libtiff.build.sh new file mode 100755 index 0000000..25661a2 --- /dev/null +++ b/libtiff.build.sh @@ -0,0 +1,51 @@ +#!/bin/bash +{ +set -x +set -e +set -u + +. build.profile + +function B_LIBTIFF { + +SRCURL="${BUILD_libtiff_SRCURL}" + +BUILD_PKG=${BUILD_libtiff} + +PREFIX="${PREFIX}/${BUILD_PKG}" + +mkdir -p "${PREFIX}" + +cat >"${PREFIX}"/profile <<-EOF +PATH=${PREFIX}/bin:\$PATH +PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +EOF + + +test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz +test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" + +cd "${BUILD_PKG}" + +local _conf=( + --prefix="${PREFIX}" + --enable-gpl + --enable-version3 + --enable-nonfree + --enable-gray + --disable-doc +) + +./configure "${_conf[@]}" + +make -j "${NPROC}" install + +} + +pushd "${BUILD_DIR}" + +B_LIBTIFF + +popd + +} From 872772fb8eff8fda76569a8fbcf487dee04f1268 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Thu, 16 Jan 2025 12:44:52 +0100 Subject: [PATCH 02/12] wip --- README.todo | 5 +++++ build.sudo | 1 - buildall.sh | 1 + imagemagick.build.sh | 1 + jbig2enc.build.sh | 3 +++ leptonica.build.sh | 4 ++++ libtiff.build.sh | 7 ++----- profile.build.sh | 1 + tesseract.build.sh | 22 +++++++++++++++++++--- 9 files changed, 36 insertions(+), 9 deletions(-) diff --git a/README.todo b/README.todo index a23f457..42eff0c 100644 --- a/README.todo +++ b/README.todo @@ -2,6 +2,11 @@ dependency tree: dot REAME.dot +bug: + + libtiff sollte den LD_LIBRARY_PATH setzen, siehe /home/paperless/2.13.5.1/zbar-0.23.93/profile, sonst findet er zwar die header files zum compilieren aber er lädt /usr/lib/libtiff ... und die ist alt. + + bug: ☐ https://github.com/jonaswinkler/paperless-ng/issues/1490 ☐ https://github.com/paperless-ngx/paperless-ngx/discussions/3090 diff --git a/build.sudo b/build.sudo index 097dced..1269dfc 100755 --- a/build.sudo +++ b/build.sudo @@ -21,7 +21,6 @@ PKGS=( libpq-dev libreadline-dev libssl-dev - libtiff-dev libtool ninja-build yasm diff --git a/buildall.sh b/buildall.sh index adf9593..c3ee2f0 100755 --- a/buildall.sh +++ b/buildall.sh @@ -71,6 +71,7 @@ popd [ -d "${BUILD_DIR}/${BUILD_python}" ] || ./Python.build.sh [ -d "${BUILD_DIR}/${BUILD_node}" ] || ./node.build.sh [ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh +[ -d "${BUILD_DIR}/${BUILD_libtiff}" ] || ./libtiff.build.sh [ -d "${BUILD_DIR}/${BUILD_imagemagick}" ] || ./imagemagick.build.sh [ -d "${BUILD_DIR}/${BUILD_pngquant}" ] || ./pngquant.build.sh [ -d "${BUILD_DIR}/${BUILD_unpaper}" ] || ./unpaper.build.sh diff --git a/imagemagick.build.sh b/imagemagick.build.sh index a057867..70bec70 100755 --- a/imagemagick.build.sh +++ b/imagemagick.build.sh @@ -7,6 +7,7 @@ set -u . build.profile . ${PREFIX}/${BUILD_ffmpeg}/profile +. ${PREFIX}/${BUILD_libtiff}/profile function B_IMAGEMAGICK { diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index 3602abd..dff0bf7 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -7,6 +7,7 @@ set -u . build.profile . ${PREFIX}/${BUILD_python}/profile +. ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile function B_JBIG2ENC { @@ -45,6 +46,8 @@ export LDFLAGS CPPFLAGS="-I${PROJECT}/${BUILD_leptonica}/include" export CPPFLAGS +export PKG_CONFIG_PATH + ./autogen.sh ./configure "${_conf[@]}" diff --git a/leptonica.build.sh b/leptonica.build.sh index bda3a49..10717ae 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -6,6 +6,7 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_imagemagick}/profile function B_LEPTONICA { @@ -21,6 +22,7 @@ mkdir -p $PREFIX cat >$PREFIX/profile <<-EOF PATH=${PREFIX}/bin:\$PATH PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} EOF test -e ${BUILD_PKG}.tar.gz || wget -nv ${SRCURL} -O ${BUILD_PKG}.tar.gz @@ -28,6 +30,8 @@ test -d ${BUILD_PKG} || mkdir -pv ${BUILD_PKG} && tar -xf ${BUILD_PKG}.tar.gz -- cd ${BUILD_PKG} +export PKG_CONFIG_PATH + local _conf=( --prefix ${PREFIX} ) diff --git a/libtiff.build.sh b/libtiff.build.sh index 25661a2..f505d3e 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -19,6 +19,7 @@ mkdir -p "${PREFIX}" cat >"${PREFIX}"/profile <<-EOF PATH=${PREFIX}/bin:\$PATH PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} EOF @@ -29,11 +30,7 @@ cd "${BUILD_PKG}" local _conf=( --prefix="${PREFIX}" - --enable-gpl - --enable-version3 - --enable-nonfree - --enable-gray - --disable-doc + --disable-rpath ) ./configure "${_conf[@]}" diff --git a/profile.build.sh b/profile.build.sh index 2d9f1ad..24aba26 100755 --- a/profile.build.sh +++ b/profile.build.sh @@ -26,6 +26,7 @@ PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin . ${PROJECT}/${BUILD_pngquant}/profile . ${PROJECT}/${BUILD_leptonica}/profile . ${PROJECT}/${BUILD_tesseract}/profile +. ${PROJECT}/${BUILD_libtiff}/profile XDG_CACHE_HOME=${XDG_CACHE_HOME} TMPDIR=${TMPDIR} diff --git a/tesseract.build.sh b/tesseract.build.sh index 8494f82..01e9d82 100755 --- a/tesseract.build.sh +++ b/tesseract.build.sh @@ -8,6 +8,7 @@ set -u . ${PREFIX}/${BUILD_sqlite}/profile . ${PREFIX}/${BUILD_python}/profile +. ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile BUILD_PKG=${BUILD_tesseract} @@ -22,6 +23,7 @@ mkdir -p $PREFIX cat >$PREFIX/profile <<-EOF PATH=$PREFIX/bin:\$PATH +LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} EOF if [[ -e ${BUILD_PKG}.tar ]]; then @@ -42,12 +44,26 @@ local _conf=( --prefix "${PREFIX}" ) -./autogen.sh +export PKG_CONFIG_PATH -PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ -./configure "${_conf[@]}" +# ./autogen.sh + +# PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ +# ./configure "${_conf[@]}" + +local _conf=( + -DCMAKE_INSTALL_PREFIX=${PREFIX} + -DCMAKE_COLOR_MAKEFILE=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON +) + +mkdir b +pushd b + +PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" make -j "${NPROC}" install +popd popd } From 4fe9a4579392b02158c8fda24c65aabc5414cb11 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Thu, 16 Jan 2025 14:19:07 +0100 Subject: [PATCH 03/12] wip --- build.profile | 4 +++ buildall.sh | 1 + ffmpeg.build.sh | 2 ++ imagemagick.build.sh | 1 + jbig2enc.build.sh | 1 + leptonica.build.sh | 1 + libjpeg-turbo.build.sh | 56 ++++++++++++++++++++++++++++++++++++++++++ libtiff.build.sh | 2 ++ tesseract.build.sh | 25 +++++++++---------- zbar.build.sh | 2 ++ 10 files changed, 81 insertions(+), 14 deletions(-) create mode 100755 libjpeg-turbo.build.sh diff --git a/build.profile b/build.profile index f770a8b..66d108f 100644 --- a/build.profile +++ b/build.profile @@ -57,6 +57,10 @@ BUILD_libfontttf_SRCURL="https://beehive.molgen.mpg.de/31b453e0b77bacde410a34a72 BUILD_libtiff=tiff-4.7.0 BUILD_libtiff_SRCURL="https://beehive.molgen.mpg.de/3a0fa4a270a4a192b08913f88d0cfbdd/${BUILD_libtiff}.tar.gz" +# SRCURL="https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.0/libjpeg-turbo-3.1.0.tar.gz" +BUILD_libjpegturbo=libjpeg-turbo-3.1.0 +BUILD_libjpegturbo_SRCURL="https://beehive.molgen.mpg.de/ed3fb4bb4cf794898f11a6d30c54b479/${BUILD_libjpegturbo}.tar.gz" + # gits BUILD_imagemagick=imagemagick-7.1.1-41 BUILD_imagemagick_SRCURL="https://github.com/ImageMagick/ImageMagick.git" diff --git a/buildall.sh b/buildall.sh index c3ee2f0..3a37449 100755 --- a/buildall.sh +++ b/buildall.sh @@ -70,6 +70,7 @@ popd [ -d "${BUILD_DIR}/${BUILD_redis}" ] || ./redis.build.sh [ -d "${BUILD_DIR}/${BUILD_python}" ] || ./Python.build.sh [ -d "${BUILD_DIR}/${BUILD_node}" ] || ./node.build.sh +[ -d "${BUILD_DIR}/${BUILD_libjpegturbo}" ] || ./libjpeg-turbo.build.sh [ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh [ -d "${BUILD_DIR}/${BUILD_libtiff}" ] || ./libtiff.build.sh [ -d "${BUILD_DIR}/${BUILD_imagemagick}" ] || ./imagemagick.build.sh diff --git a/ffmpeg.build.sh b/ffmpeg.build.sh index cd471c9..0c001e7 100755 --- a/ffmpeg.build.sh +++ b/ffmpeg.build.sh @@ -6,6 +6,8 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile + function B_FFMPEG { SRCURL="${BUILD_ffmpeg_SRCURL}" diff --git a/imagemagick.build.sh b/imagemagick.build.sh index 70bec70..f75ae42 100755 --- a/imagemagick.build.sh +++ b/imagemagick.build.sh @@ -6,6 +6,7 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_ffmpeg}/profile . ${PREFIX}/${BUILD_libtiff}/profile diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index dff0bf7..ddcbb0e 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -7,6 +7,7 @@ set -u . build.profile . ${PREFIX}/${BUILD_python}/profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile diff --git a/leptonica.build.sh b/leptonica.build.sh index 10717ae..7acbdae 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -6,6 +6,7 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_imagemagick}/profile diff --git a/libjpeg-turbo.build.sh b/libjpeg-turbo.build.sh new file mode 100755 index 0000000..b5dcc89 --- /dev/null +++ b/libjpeg-turbo.build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +{ +set -x +set -e +set -u + +. build.profile + +function B_LIBJPEGTURBO { + +SRCURL="${BUILD_libjpegturbo_SRCURL}" + +BUILD_PKG=${BUILD_libjpegturbo} + +PREFIX="${PREFIX}/${BUILD_PKG}" + +mkdir -p "${PREFIX}" + +cat >"${PREFIX}"/profile <<-EOF +PATH=${PREFIX}/bin:\$PATH +PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} +EOF + + +test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz +test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" + +cd "${BUILD_PKG}" + +local _conf=( + -DCMAKE_INSTALL_PREFIX=${PREFIX} + -DCMAKE_INSTALL_LIBDIR=lib + -DCMAKE_COLOR_MAKEFILE=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON + -DWITH_JPEG7=true + -DWITH_JPEG8=true +) + +rm -rf b +mkdir b +pushd b +# PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" +cmake .. "${_conf[@]}" +make -j "${NPROC}" install +popd + +} + +pushd "${BUILD_DIR}" + +B_LIBJPEGTURBO + +popd + +} diff --git a/libtiff.build.sh b/libtiff.build.sh index f505d3e..39ba242 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -6,6 +6,8 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile + function B_LIBTIFF { SRCURL="${BUILD_libtiff_SRCURL}" diff --git a/tesseract.build.sh b/tesseract.build.sh index 01e9d82..0969a40 100755 --- a/tesseract.build.sh +++ b/tesseract.build.sh @@ -46,24 +46,21 @@ local _conf=( export PKG_CONFIG_PATH -# ./autogen.sh +./autogen.sh -# PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ -# ./configure "${_conf[@]}" +PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ +./configure "${_conf[@]}" -local _conf=( - -DCMAKE_INSTALL_PREFIX=${PREFIX} - -DCMAKE_COLOR_MAKEFILE=OFF - -DCMAKE_VERBOSE_MAKEFILE=ON -) - -mkdir b -pushd b - -PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" +#local _conf=( +# -DCMAKE_INSTALL_PREFIX=${PREFIX} +# -DCMAKE_COLOR_MAKEFILE=OFF +# -DCMAKE_VERBOSE_MAKEFILE=ON +#) +#mkdir b +#pushd b +#PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" make -j "${NPROC}" install -popd popd } diff --git a/zbar.build.sh b/zbar.build.sh index 28a12aa..72c04d6 100755 --- a/zbar.build.sh +++ b/zbar.build.sh @@ -6,8 +6,10 @@ set -u . build.profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_imagemagick}/profile + function B_ZBAR { SRCURL=${BUILD_zbar_SRCURL} From 6592dc4ab332b5a46ed71124a99200fec9d619dc Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Thu, 16 Jan 2025 14:31:40 +0100 Subject: [PATCH 04/12] build.sudo: add cmake --- build.sudo | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sudo b/build.sudo index 1269dfc..af9942b 100755 --- a/build.sudo +++ b/build.sudo @@ -12,6 +12,7 @@ PKGS=( autoconf autopoint cargo + cmake g++ git imagemagick-6.q16 From 6ea5695542bd843121dee155ffa9c78c78d7b4c0 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Fri, 17 Jan 2025 14:54:46 +0100 Subject: [PATCH 05/12] wip --- README.bug | 16 ++++++++++++++++ build.profile | 2 +- jbig2enc.build.sh | 14 +++++++++----- leptonica.build.sh | 15 ++++++++++++++- libjpeg-turbo.build.sh | 5 +++-- libtiff.build.sh | 3 ++- rebuild.sh | 16 ++++++++++++++++ 7 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 README.bug create mode 100755 rebuild.sh diff --git a/README.bug b/README.bug new file mode 100644 index 0000000..5626fea --- /dev/null +++ b/README.bug @@ -0,0 +1,16 @@ +Error in pixReadMemTiff: function not present +Error in pixReadMem: tiff: no pix returned +Error in pixaGenerateFontFromString: pix not made +Error in bmfCreate: font pixa not made + +pixReadMemTiff ist aus leptonica + +leptonica : build/leptonica-1.85.0/src/tiffio.c : pixReadMemTiff(const l_uint8 *cdata + +"function not present" kommt aus build/leptonica-1.85.0/src/tiffiostub.c + +tiffiostub.c wird eingebunden, anstatt tiffio.c wenn HAVE_LIBJPEG nicht defniert ist + + !HAVE_LIBTIFF || !HAVE_LIBJPEG + + \ No newline at end of file diff --git a/build.profile b/build.profile index 66d108f..5ee5822 100644 --- a/build.profile +++ b/build.profile @@ -78,7 +78,7 @@ BUILD_tessdata=tessdata_best-4.1.0 BUILD_tessdata_SRCURL="https://github.com/tesseract-ocr/tessdata_best.git" BUILD_tessconfigs_SRCURL="https://github.com/tesseract-ocr/tessconfigs.git" -BUILD_jbig2enc=jbig2enc-0.28-17-gea05019 +BUILD_jbig2enc=jbig2enc-0.30-14-g6019f5f BUILD_jbig2enc_SRCURL="https://github.com/agl/jbig2enc.git" BUILD_jbig2dec=jbig2dec-0.20 diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index ddcbb0e..54abee4 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -7,8 +7,8 @@ set -u . build.profile . ${PREFIX}/${BUILD_python}/profile -. ${PREFIX}/${BUILD_libjpegturbo}/profile -. ${PREFIX}/${BUILD_libtiff}/profile +#. ${PREFIX}/${BUILD_libjpegturbo}/profile +#. ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile function B_JBIG2ENC { @@ -42,16 +42,20 @@ local _conf=( --prefix ${PREFIX} ) -LDFLAGS=$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L lept) +LDFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L lept)" +# LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L libtiff-4)" +#LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libtiff-4)" export LDFLAGS + CPPFLAGS="-I${PROJECT}/${BUILD_leptonica}/include" +#CFLAGS+=" -I${PROJECT}/${BUILD_libtiff}/include" export CPPFLAGS -export PKG_CONFIG_PATH +#export PKG_CONFIG_PATH ./autogen.sh -./configure "${_conf[@]}" +PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ./configure "${_conf[@]}" make -j ${NPROC} install diff --git a/leptonica.build.sh b/leptonica.build.sh index 7acbdae..e916192 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -31,7 +31,20 @@ test -d ${BUILD_PKG} || mkdir -pv ${BUILD_PKG} && tar -xf ${BUILD_PKG}.tar.gz -- cd ${BUILD_PKG} -export PKG_CONFIG_PATH +#local _conf=( +# -DCMAKE_INSTALL_PREFIX=${PREFIX} +# -DENABLE_OPENJPEG=OFF +#) + +#rm -rf b +#mkdir b +#pushd b +#PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" +#make -j "${NPROC}" install +# wtf +#mv -v ${PREFIX}/lib/pkgconfig/lept_Release.pc ${PREFIX}/lib/pkgconfig/lept.pc +#popd + local _conf=( --prefix ${PREFIX} diff --git a/libjpeg-turbo.build.sh b/libjpeg-turbo.build.sh index b5dcc89..dd46e3f 100755 --- a/libjpeg-turbo.build.sh +++ b/libjpeg-turbo.build.sh @@ -26,7 +26,7 @@ EOF test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" -cd "${BUILD_PKG}" +pushd "${BUILD_PKG}" local _conf=( -DCMAKE_INSTALL_PREFIX=${PREFIX} @@ -34,7 +34,6 @@ local _conf=( -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DWITH_JPEG7=true - -DWITH_JPEG8=true ) rm -rf b @@ -45,6 +44,8 @@ cmake .. "${_conf[@]}" make -j "${NPROC}" install popd +popd + } pushd "${BUILD_DIR}" diff --git a/libtiff.build.sh b/libtiff.build.sh index 39ba242..502e4b2 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -32,7 +32,8 @@ cd "${BUILD_PKG}" local _conf=( --prefix="${PREFIX}" - --disable-rpath +# --disable-rpath +# --disable-shared ) ./configure "${_conf[@]}" diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..934a752 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +. build.profile + +set -u +set -e + +for arg; do +PKG=$arg +eval BT=\$BUILD_$PKG +echo "# $BT" +[ -d "${BUILD_DIR}/${BT}" ] && echo "rm -rf '${BUILD_DIR}/${BT}'" +[ -d "${PREFIX}/${BT}" ] && echo "rm -rf '${PREFIX}/${BT}'" +done + + From 2e6f2e48bbb46b51216f3e3e2b0fb94125db7f2e Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 20 Jan 2025 09:36:34 +0100 Subject: [PATCH 06/12] WIP --- README.bug | 37 +++++++++++++++++++++++++++++++++++-- build.profile | 2 +- leptonica.build.sh | 1 + profile.build.sh | 2 +- tesseract.build.sh | 8 ++++++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/README.bug b/README.bug index 5626fea..ec4fbb4 100644 --- a/README.bug +++ b/README.bug @@ -11,6 +11,39 @@ leptonica : build/leptonica-1.85.0/src/tiffio.c : pixReadMemTiff(const l_uint8 tiffiostub.c wird eingebunden, anstatt tiffio.c wenn HAVE_LIBJPEG nicht defniert ist - !HAVE_LIBTIFF || !HAVE_LIBJPEG +52: #if !HAVE_LIBTIFF || !HAVE_LIBJPEG /* defined in environ.h */ + +config.log @ leptonica sagt: finde pkg-config libtiff-4 nicht +"No package 'libtiff-4' found" + +configure:14837: checking for libtiff-4 +configure:14844: $PKG_CONFIG --exists --print-errors "libtiff-4" +Package libtiff-4 was not found in the pkg-config search path. + +- wir bauen jetzt leptonica so lange, bis der libtiff findet + + is da : ~/2135-debug/tiff-4.7.0/lib/pkgconfig/libtiff-4.pc + + das profile von tiff- setzt auch den PKG_CONFIG_PATH: +paperless@server:~/git/paperless-baremetal$ cat ~/2135-debug/tiff-4.7.0/profile +PATH=/home/paperless/2135-debug/tiff-4.7.0/bin:$PATH +PKG_CONFIG_PATH=/home/paperless/2135-debug/tiff-4.7.0/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH:-} +LD_LIBRARY_PATH=/home/paperless/2135-debug/tiff-4.7.0/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-} + + + das profile von tiff wird in leptonica gesourced + + + exportiere jetzt mal PKG_CONFIG_PATH - \ No newline at end of file + - er meckert er würde jetzt libjpeg.so.7 nicht finden. + + die gibts aber: + paperless@server:~/git/paperless-baremetal$ find ~/2135-debug/ | grep jpeg.so + /home/paperless/2135-debug/libjpeg-turbo-3.1.0/lib/libjpeg.so.7.4.0 + + Im PKG_CONFIG_PATH steht sie auch drin + + config.log auch alles OK: + JPEG_CFLAGS='-I/home/paperless/2135-debug/libjpeg-turbo-3.1.0/include' + JPEG_LIBS='-L/home/paperless/2135-debug/libjpeg-turbo-3.1.0/lib -ljpeg' + PKG_CONFIG_PATH='/home/paperless/2135-debug/imagemagick-7.1.1-41/lib/pkgconfig:/home/paperless/2135-debug/tiff-4.7.0/lib/pkgconfig:/home/paperless/2135-debug/libjpeg-turbo-3.1.0/lib/pkgconfig' + #define HAVE_LIBJPEG 1 + - diffs zwischen 'notiff und nojepg, + + config.log: sollte gehen, kennt HAVE_LIBTIFF und HAVE_LIBJPEG, alles korrekt + + config_auto.h: auch ok + + config.status: auch ok + diff --git a/build.profile b/build.profile index 5ee5822..8b1f607 100644 --- a/build.profile +++ b/build.profile @@ -1,4 +1,4 @@ -BUILD_TAG=2.13.5 +BUILD_TAG=2135-debug BUILD_paperless=paperless-ngx-2.13.5 diff --git a/leptonica.build.sh b/leptonica.build.sh index e916192..0f191c9 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -45,6 +45,7 @@ cd ${BUILD_PKG} #mv -v ${PREFIX}/lib/pkgconfig/lept_Release.pc ${PREFIX}/lib/pkgconfig/lept.pc #popd +export PKG_CONFIG_PATH local _conf=( --prefix ${PREFIX} diff --git a/profile.build.sh b/profile.build.sh index 24aba26..4f841b7 100755 --- a/profile.build.sh +++ b/profile.build.sh @@ -24,8 +24,8 @@ PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin . ${PROJECT}/${BUILD_unpaper}/profile . ${PROJECT}/${BUILD_ffmpeg}/profile . ${PROJECT}/${BUILD_pngquant}/profile -. ${PROJECT}/${BUILD_leptonica}/profile . ${PROJECT}/${BUILD_tesseract}/profile +. ${PROJECT}/${BUILD_leptonica}/profile . ${PROJECT}/${BUILD_libtiff}/profile XDG_CACHE_HOME=${XDG_CACHE_HOME} diff --git a/tesseract.build.sh b/tesseract.build.sh index 0969a40..94cce8f 100755 --- a/tesseract.build.sh +++ b/tesseract.build.sh @@ -46,6 +46,14 @@ local _conf=( export PKG_CONFIG_PATH +LDFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L lept)" +LDFLAGS="-Wl,-rpath -Wl,$(pkg-config --variable=libdir lept)" +export LDFLAGS +# -Wl,-rpath,-WL,$(pkg-config --variable=libdir lept) +# - use the '-Wl,-rpath -Wl,LIBDIR' linker flag + + + ./autogen.sh PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \ From 969b73f4df2a06113eaaee0b34abfb44bde7efd9 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 20 Jan 2025 13:32:03 +0100 Subject: [PATCH 07/12] WIP --- build.profile | 6 ++--- buildall.sh | 2 +- leptonica.build.sh | 3 +++ libjpegturbo.build.sh | 56 +++++++++++++++++++++++++++++++++++++++++++ profile.build.sh | 1 + rebuild.sh | 4 +--- tesseract.build.sh | 1 + 7 files changed, 66 insertions(+), 7 deletions(-) create mode 100755 libjpegturbo.build.sh diff --git a/build.profile b/build.profile index 8b1f607..8fdf719 100644 --- a/build.profile +++ b/build.profile @@ -1,4 +1,4 @@ -BUILD_TAG=2135-debug +BUILD_TAG=2.13.5 BUILD_paperless=paperless-ngx-2.13.5 @@ -58,8 +58,8 @@ BUILD_libtiff=tiff-4.7.0 BUILD_libtiff_SRCURL="https://beehive.molgen.mpg.de/3a0fa4a270a4a192b08913f88d0cfbdd/${BUILD_libtiff}.tar.gz" # SRCURL="https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.0/libjpeg-turbo-3.1.0.tar.gz" -BUILD_libjpegturbo=libjpeg-turbo-3.1.0 -BUILD_libjpegturbo_SRCURL="https://beehive.molgen.mpg.de/ed3fb4bb4cf794898f11a6d30c54b479/${BUILD_libjpegturbo}.tar.gz" +BUILD_libjpegturbo=libjpegturbo-3.1.0 +BUILD_libjpegturbo_SRCURL="https://beehive.molgen.mpg.de/ed3fb4bb4cf794898f11a6d30c54b479/libjpeg-turbo-3.1.0.tar.gz" # gits BUILD_imagemagick=imagemagick-7.1.1-41 diff --git a/buildall.sh b/buildall.sh index 3a37449..eaec57a 100755 --- a/buildall.sh +++ b/buildall.sh @@ -70,7 +70,7 @@ popd [ -d "${BUILD_DIR}/${BUILD_redis}" ] || ./redis.build.sh [ -d "${BUILD_DIR}/${BUILD_python}" ] || ./Python.build.sh [ -d "${BUILD_DIR}/${BUILD_node}" ] || ./node.build.sh -[ -d "${BUILD_DIR}/${BUILD_libjpegturbo}" ] || ./libjpeg-turbo.build.sh +[ -d "${BUILD_DIR}/${BUILD_libjpegturbo}" ] || ./libjpegturbo.build.sh [ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh [ -d "${BUILD_DIR}/${BUILD_libtiff}" ] || ./libtiff.build.sh [ -d "${BUILD_DIR}/${BUILD_imagemagick}" ] || ./imagemagick.build.sh diff --git a/leptonica.build.sh b/leptonica.build.sh index 0f191c9..3823aad 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -49,6 +49,9 @@ export PKG_CONFIG_PATH local _conf=( --prefix ${PREFIX} + --without-libopenjpeg + --disable-shared + --with-pic ) ./configure "${_conf[@]}" diff --git a/libjpegturbo.build.sh b/libjpegturbo.build.sh new file mode 100755 index 0000000..219d2a4 --- /dev/null +++ b/libjpegturbo.build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +{ +set -x +set -e +set -u + +. build.profile + +function B_LIBJPEGTURBO { + +SRCURL="${BUILD_libjpegturbo_SRCURL}" + +BUILD_PKG=${BUILD_libjpegturbo} + +PREFIX="${PREFIX}/${BUILD_PKG}" + +mkdir -p "${PREFIX}" + +cat >"${PREFIX}"/profile <<-EOF +PATH=${PREFIX}/bin:\$PATH +PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} +EOF + + +test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz +test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" + +pushd "${BUILD_PKG}" + +local _conf=( + -DCMAKE_INSTALL_PREFIX=${PREFIX} + -DCMAKE_INSTALL_LIBDIR=lib + -DCMAKE_COLOR_MAKEFILE=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON +) + +rm -rf b +mkdir b +pushd b +# PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" +cmake .. "${_conf[@]}" +make -j "${NPROC}" install +popd + +popd + +} + +pushd "${BUILD_DIR}" + +B_LIBJPEGTURBO + +popd + +} diff --git a/profile.build.sh b/profile.build.sh index 4f841b7..f307902 100755 --- a/profile.build.sh +++ b/profile.build.sh @@ -27,6 +27,7 @@ PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin . ${PROJECT}/${BUILD_tesseract}/profile . ${PROJECT}/${BUILD_leptonica}/profile . ${PROJECT}/${BUILD_libtiff}/profile +. ${PROJECT}/${BUILD_libjpegturbo}/profile XDG_CACHE_HOME=${XDG_CACHE_HOME} TMPDIR=${TMPDIR} diff --git a/rebuild.sh b/rebuild.sh index 934a752..99d93aa 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -6,11 +6,9 @@ set -u set -e for arg; do -PKG=$arg +PKG=${arg/\.build\.sh/} eval BT=\$BUILD_$PKG echo "# $BT" [ -d "${BUILD_DIR}/${BT}" ] && echo "rm -rf '${BUILD_DIR}/${BT}'" [ -d "${PREFIX}/${BT}" ] && echo "rm -rf '${PREFIX}/${BT}'" done - - diff --git a/tesseract.build.sh b/tesseract.build.sh index 94cce8f..d24fa18 100755 --- a/tesseract.build.sh +++ b/tesseract.build.sh @@ -8,6 +8,7 @@ set -u . ${PREFIX}/${BUILD_sqlite}/profile . ${PREFIX}/${BUILD_python}/profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile From ec4cb929f858780a422b569eb96b0fdfed53111c Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Tue, 21 Jan 2025 08:07:42 +0100 Subject: [PATCH 08/12] paperless 2.13.5 going static --- README.bug | 46 ++++++++++++++++++++++++++++++- build.profile | 4 +++ buildall.sh | 1 + checkversions.sh | 10 +++++++ ffmpeg.build.sh | 1 + imagemagick.build.sh | 4 ++- jbig2enc.build.sh | 39 ++++++++++++++++++++++---- leptonica.build.sh | 1 + libjpeg-turbo.build.sh | 57 -------------------------------------- libtiff.build.sh | 3 +- libwebp.build.sh | 62 ++++++++++++++++++++++++++++++++++++++++++ profile.build.sh | 1 + tesseract.build.sh | 1 + 13 files changed, 164 insertions(+), 66 deletions(-) delete mode 100755 libjpeg-turbo.build.sh create mode 100755 libwebp.build.sh diff --git a/README.bug b/README.bug index ec4fbb4..1db21eb 100644 --- a/README.bug +++ b/README.bug @@ -33,6 +33,7 @@ LD_LIBRARY_PATH=/home/paperless/2135-debug/tiff-4.7.0/lib${LD_LIBRARY_PATH:+:}${ + exportiere jetzt mal PKG_CONFIG_PATH - er meckert er würde jetzt libjpeg.so.7 nicht finden. + "/bin/ld: ../src/.libs/libleptonica.so: undefined reference to `jpeg_start_decompress@LIBJPEG_7.0'" + die gibts aber: paperless@server:~/git/paperless-baremetal$ find ~/2135-debug/ | grep jpeg.so /home/paperless/2135-debug/libjpeg-turbo-3.1.0/lib/libjpeg.so.7.4.0 @@ -46,4 +47,47 @@ LD_LIBRARY_PATH=/home/paperless/2135-debug/tiff-4.7.0/lib${LD_LIBRARY_PATH:+:}${ + config.log: sollte gehen, kennt HAVE_LIBTIFF und HAVE_LIBJPEG, alles korrekt + config_auto.h: auch ok + config.status: auch ok - + + Makefile: auch ok + eventuell bindet der grundsätzlich die JPEG_CFLAGS nicht ein ? + ich find nix + mal ab hier mit 1.84.1 ? Nope. + + die libs stimmen auch...: + + nm ./libjpegturbo-3.1.0/lib/libjpeg.so.7.4.0 | grep jpeg_calc_output_dimensions + 000000000004ace0 T jpeg_calc_output_dimensions + symbol ist in text (code) section (T). + nm ./leptonica-1.85.0/lib/libleptonica.so.6.0.0 | grep jpeg_calc_output_dimensions + U jpeg_calc_output_dimensions@LIBJPEG_7.0 + undefined, also extern (U) + nm ./libjpegturbo-3.1.0/bin/djpeg | grep jpeg_calc_output_dimensions + U jpeg_calc_output_dimensions@LIBJPEG_7.0 + ldd ./libjpegturbo-3.1.0/bin/djpeg + linux-vdso.so.1 (0x00007ffda8d52000) + libjpeg.so.7 => /home/paperless/2135-debug/libjpegturbo-3.1.0/lib/libjpeg.so.7 (0x00007f61f9078000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f61f8e00000) + /lib64/ld-linux-x86-64.so.2 (0x00007f61f914a000) + versuchen wir mal static libjpeg + + leptonica baut durch + - tesseract failed: + /bin/ld: /home/paperless/2135-debug/leptonica-1.85.0/lib/libleptonica.a(writefile.o): warning: relocation against `NumImageFileFormatExtensions' in read-only section `.text' + /bin/ld: /home/paperless/2135-debug/leptonica-1.85.0/lib/libleptonica.a(colorspace.o): relocation R_X86_64_PC32 against symbol `LeptMsgSeverity' can not be used when making a shared object; recompile with -fPIC + /bin/ld: final link failed: bad value + collect2: error: ld returned 1 exit status + - --with-pic bei leptonica ... +... hmmm... ich glaube ich bin wieder an anfang.... + + + ./manage.py migrate + SystemCheckError: System check identified some issues: + + ERRORS: + ?: The selected ocr language deu is not installed. Paperless cannot OCR your documents without it. Please fix PAPERLESS_OCR_LANGUAGE. + ?: The selected ocr language eng is not installed. Paperless cannot OCR your documents without it. Please fix PAPERLESS_OCR_LANGUAGE. + + - ./tesseract-5.5.0/bin/tesseract: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory + + - clean build auf 2.13.5.1 + - jbig2enc failed + checking for findFileFormatStream in -lleptonica... no + Error! Leptonica not detected. + + diff --git a/build.profile b/build.profile index 8fdf719..c7409ad 100644 --- a/build.profile +++ b/build.profile @@ -61,6 +61,10 @@ BUILD_libtiff_SRCURL="https://beehive.molgen.mpg.de/3a0fa4a270a4a192b08913f88d0c BUILD_libjpegturbo=libjpegturbo-3.1.0 BUILD_libjpegturbo_SRCURL="https://beehive.molgen.mpg.de/ed3fb4bb4cf794898f11a6d30c54b479/libjpeg-turbo-3.1.0.tar.gz" +# SRCURL="https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.5.0.tar.gz" +BUILD_libwebp=libwebp-1.5.0 +BUILD_libwebp_SRCURL[0]="https://beehive.molgen.mpg.de/8f659e426eaa2aeec4b36bc9ea43b3f3/${BUILD_libwebp}.tar.gz" + # gits BUILD_imagemagick=imagemagick-7.1.1-41 BUILD_imagemagick_SRCURL="https://github.com/ImageMagick/ImageMagick.git" diff --git a/buildall.sh b/buildall.sh index eaec57a..8ac3865 100755 --- a/buildall.sh +++ b/buildall.sh @@ -73,6 +73,7 @@ popd [ -d "${BUILD_DIR}/${BUILD_libjpegturbo}" ] || ./libjpegturbo.build.sh [ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh [ -d "${BUILD_DIR}/${BUILD_libtiff}" ] || ./libtiff.build.sh +[ -d "${BUILD_DIR}/${BUILD_libwebp}" ] || ./libwebp.build.sh [ -d "${BUILD_DIR}/${BUILD_imagemagick}" ] || ./imagemagick.build.sh [ -d "${BUILD_DIR}/${BUILD_pngquant}" ] || ./pngquant.build.sh [ -d "${BUILD_DIR}/${BUILD_unpaper}" ] || ./unpaper.build.sh diff --git a/checkversions.sh b/checkversions.sh index d5c3e15..8814a73 100755 --- a/checkversions.sh +++ b/checkversions.sh @@ -134,6 +134,14 @@ if [[ -e "$PROJECT"/profile ]]; then pngquant -V mtype pngquant } + function exec_BUILD_libwebp () { + webpinfo -version + mtype webpinfo + } + function exec_BUILD_libjpegturbo () { + cjpeg -version + mtype cjpeg + } fi @@ -224,6 +232,8 @@ BUILD_sqlite BUILD_nginx BUILD_tesseract BUILD_tessdata +BUILD_libwebp +BUILD_libjpegturbo BUILD_jbig2dec BUILD_jbig2enc BUILD_leptonica diff --git a/ffmpeg.build.sh b/ffmpeg.build.sh index 0c001e7..0735bb3 100755 --- a/ffmpeg.build.sh +++ b/ffmpeg.build.sh @@ -7,6 +7,7 @@ set -u . build.profile . ${PREFIX}/${BUILD_libjpegturbo}/profile +. ${PREFIX}/${BUILD_libwebp}/profile function B_FFMPEG { diff --git a/imagemagick.build.sh b/imagemagick.build.sh index f75ae42..d046d80 100755 --- a/imagemagick.build.sh +++ b/imagemagick.build.sh @@ -9,6 +9,7 @@ set -u . ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_ffmpeg}/profile . ${PREFIX}/${BUILD_libtiff}/profile +. ${PREFIX}/${BUILD_libwebp}/profile function B_IMAGEMAGICK { @@ -60,7 +61,8 @@ local _conf=( --without-x ) -./configure "${_conf[@]}" +LDFLAGS=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libjpeg)" \ +PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-} ./configure "${_conf[@]}" make install diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index 54abee4..6b62d2c 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -7,8 +7,9 @@ set -u . build.profile . ${PREFIX}/${BUILD_python}/profile -#. ${PREFIX}/${BUILD_libjpegturbo}/profile -#. ${PREFIX}/${BUILD_libtiff}/profile +. ${PREFIX}/${BUILD_libwebp}/profile +. ${PREFIX}/${BUILD_libjpegturbo}/profile +. ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile function B_JBIG2ENC { @@ -40,16 +41,42 @@ pushd ${BUILD_PKG} local _conf=( --prefix ${PREFIX} + --with-pic +# --disable-shared ) -LDFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L lept)" +# LDFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L lept)" +# export + +# LEPTONICA_CFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --cflags lept)" +# export + +# LEPTONICA_LIBS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs lept)" + +LDFLAGS="$(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libtiff-4)" +LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs lept)" +LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libjpeg)" +LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libwebp)" +export LDFLAGS + +CFLAGS="-I${PROJECT}/${BUILD_leptonica}/include" +CFLAGS+=" -I${PROJECT}/${BUILD_libtiff}/include" +CFLAGS+=" -I${PROJECT}/${BUILD_libwebp}/include" +export CFLAGS + +CPPFLAGS=${CFLAGS} +export CPPFLAGS + +LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd' +export LIBS + # LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L libtiff-4)" #LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs libtiff-4)" -export LDFLAGS +# export LDFLAGS -CPPFLAGS="-I${PROJECT}/${BUILD_leptonica}/include" +# CPPFLAGS="-I${PROJECT}/${BUILD_leptonica}/include" #CFLAGS+=" -I${PROJECT}/${BUILD_libtiff}/include" -export CPPFLAGS +# export CPPFLAGS #export PKG_CONFIG_PATH diff --git a/leptonica.build.sh b/leptonica.build.sh index 3823aad..8402b9b 100755 --- a/leptonica.build.sh +++ b/leptonica.build.sh @@ -8,6 +8,7 @@ set -u . ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_libtiff}/profile +. ${PREFIX}/${BUILD_libwebp}/profile . ${PREFIX}/${BUILD_imagemagick}/profile function B_LEPTONICA { diff --git a/libjpeg-turbo.build.sh b/libjpeg-turbo.build.sh deleted file mode 100755 index dd46e3f..0000000 --- a/libjpeg-turbo.build.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -{ -set -x -set -e -set -u - -. build.profile - -function B_LIBJPEGTURBO { - -SRCURL="${BUILD_libjpegturbo_SRCURL}" - -BUILD_PKG=${BUILD_libjpegturbo} - -PREFIX="${PREFIX}/${BUILD_PKG}" - -mkdir -p "${PREFIX}" - -cat >"${PREFIX}"/profile <<-EOF -PATH=${PREFIX}/bin:\$PATH -PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} -LD_LIBRARY_PATH=${PROJECT}/${BUILD_PKG}/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-} -EOF - - -test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz -test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" - -pushd "${BUILD_PKG}" - -local _conf=( - -DCMAKE_INSTALL_PREFIX=${PREFIX} - -DCMAKE_INSTALL_LIBDIR=lib - -DCMAKE_COLOR_MAKEFILE=OFF - -DCMAKE_VERBOSE_MAKEFILE=ON - -DWITH_JPEG7=true -) - -rm -rf b -mkdir b -pushd b -# PKG_CONFIG_PATH=${PKG_CONFIG_PATH} cmake .. "${_conf[@]}" -cmake .. "${_conf[@]}" -make -j "${NPROC}" install -popd - -popd - -} - -pushd "${BUILD_DIR}" - -B_LIBJPEGTURBO - -popd - -} diff --git a/libtiff.build.sh b/libtiff.build.sh index 502e4b2..e0e8485 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -33,7 +33,8 @@ cd "${BUILD_PKG}" local _conf=( --prefix="${PREFIX}" # --disable-rpath -# --disable-shared + --disable-shared + --with-pic ) ./configure "${_conf[@]}" diff --git a/libwebp.build.sh b/libwebp.build.sh new file mode 100755 index 0000000..13726ca --- /dev/null +++ b/libwebp.build.sh @@ -0,0 +1,62 @@ +#!/bin/bash +{ +set -x +set -e +set -u + +. build.profile + +# . ${PREFIX}/${BUILD_libjpegturbo}/profile + . ${PREFIX}/${BUILD_libtiff}/profile + +function B_LIBWEBP { + +SRCURL="${BUILD_libwebp_SRCURL}" + +BUILD_PKG=${BUILD_libwebp} + +PREFIX="${PREFIX}/${BUILD_PKG}" + +mkdir -p "${PREFIX}" + +cat >"${PREFIX}"/profile <<-EOF +PATH=${PREFIX}/bin:\$PATH +PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +EOF + + +test -e "${BUILD_PKG}".tar.gz || wget -nv "${SRCURL}" -O "${BUILD_PKG}".tar.gz +test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}".tar.gz --strip-components=1 -C "${BUILD_PKG}" + +cd "${BUILD_PKG}" + + + +local _conf=( + --prefix="${PREFIX}" + --enable-libwebpmux + --enable-libwebpdemux + --enable-libwebpdecoder + --enable-libwebpextras + --enable-swap-16bit-csp + --disable-shared + --with-pic + --with-jpegincludedir=${PROJECT}/${BUILD_libjpegturbo}/include + --with-jpeglibdir=${PROJECT}/${BUILD_libjpegturbo}/lib + --with-tiffincludedir=${PROJECT}/${BUILD_libtiff}/include + --with-tifflibdir=${PROJECT}/${BUILD_libtiff}/lib +) + +./configure "${_conf[@]}" + +make -j "${NPROC}" install + +} + +pushd "${BUILD_DIR}" + +B_LIBWEBP + +popd + +} diff --git a/profile.build.sh b/profile.build.sh index f307902..7bc30c9 100755 --- a/profile.build.sh +++ b/profile.build.sh @@ -28,6 +28,7 @@ PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin . ${PROJECT}/${BUILD_leptonica}/profile . ${PROJECT}/${BUILD_libtiff}/profile . ${PROJECT}/${BUILD_libjpegturbo}/profile +. ${PROJECT}/${BUILD_libwebp}/profile XDG_CACHE_HOME=${XDG_CACHE_HOME} TMPDIR=${TMPDIR} diff --git a/tesseract.build.sh b/tesseract.build.sh index d24fa18..837a52d 100755 --- a/tesseract.build.sh +++ b/tesseract.build.sh @@ -8,6 +8,7 @@ set -u . ${PREFIX}/${BUILD_sqlite}/profile . ${PREFIX}/${BUILD_python}/profile +. ${PREFIX}/${BUILD_libwebp}/profile . ${PREFIX}/${BUILD_libjpegturbo}/profile . ${PREFIX}/${BUILD_libtiff}/profile . ${PREFIX}/${BUILD_leptonica}/profile From 54cef308d60176d932b9648a9506c9ee2215d702 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Tue, 21 Jan 2025 10:57:25 +0100 Subject: [PATCH 09/12] WIP --- README.dot | 8 ++++++++ buildall.sh | 2 +- jbig2enc.build.sh | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.dot b/README.dot index 6282a3d..edbd24e 100644 --- a/README.dot +++ b/README.dot @@ -14,12 +14,20 @@ digraph depends { JE [ label="jbig2enc" ] JD [ label="jbig2dec" ] NG [ label="nginx" ] + JP [ label="libjpegturbo" ] + TI [ label="libtiff" ] + WP [ label="libwebp" ] SQ -> PY PY -> NO SQ -> NO + + TI -> WP + + { JP, WP } -> FF + FF -> PN FF -> UN diff --git a/buildall.sh b/buildall.sh index 8ac3865..5f49049 100755 --- a/buildall.sh +++ b/buildall.sh @@ -71,9 +71,9 @@ popd [ -d "${BUILD_DIR}/${BUILD_python}" ] || ./Python.build.sh [ -d "${BUILD_DIR}/${BUILD_node}" ] || ./node.build.sh [ -d "${BUILD_DIR}/${BUILD_libjpegturbo}" ] || ./libjpegturbo.build.sh -[ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh [ -d "${BUILD_DIR}/${BUILD_libtiff}" ] || ./libtiff.build.sh [ -d "${BUILD_DIR}/${BUILD_libwebp}" ] || ./libwebp.build.sh +[ -d "${BUILD_DIR}/${BUILD_ffmpeg}" ] || ./ffmpeg.build.sh [ -d "${BUILD_DIR}/${BUILD_imagemagick}" ] || ./imagemagick.build.sh [ -d "${BUILD_DIR}/${BUILD_pngquant}" ] || ./pngquant.build.sh [ -d "${BUILD_DIR}/${BUILD_unpaper}" ] || ./unpaper.build.sh diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index 6b62d2c..e85cf70 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -67,7 +67,7 @@ export CFLAGS CPPFLAGS=${CFLAGS} export CPPFLAGS -LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd' +LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd -llzma' export LIBS # LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L libtiff-4)" From c567a0b0dbf0990c2ba99ba1507c55de128eda0b Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Tue, 21 Jan 2025 11:13:50 +0100 Subject: [PATCH 10/12] jbig2enc: add lib for missing SharpYuvConvert ``` /bin/ld: build/libwebp-1.5.0/src/enc/picture_csp_enc.c:181:(.text+0xd04): undefined reference to `SharpYuvConve rt' collect2: error: ld returned 1 exit status ``` --- jbig2enc.build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index e85cf70..38dc16a 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -67,7 +67,7 @@ export CFLAGS CPPFLAGS=${CFLAGS} export CPPFLAGS -LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd -llzma' +LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd -llzma -lsharpyuv' export LIBS # LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L libtiff-4)" From 9e27d5dafc06cafed6d3e24f8f0c2fe21d35de1a Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Tue, 21 Jan 2025 12:09:27 +0100 Subject: [PATCH 11/12] WIP --- jbig2enc.build.sh | 2 +- libtiff.build.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jbig2enc.build.sh b/jbig2enc.build.sh index 38dc16a..ebc0f6e 100755 --- a/jbig2enc.build.sh +++ b/jbig2enc.build.sh @@ -67,7 +67,7 @@ export CFLAGS CPPFLAGS=${CFLAGS} export CPPFLAGS -LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lpng -lz -lzstd -llzma -lsharpyuv' +LIBS='-lm -lleptonica -ltiff -ljpeg -lwebp -lsharpyuv -lpng -lz -lzstd -llzma' export LIBS # LDFLAGS+=" $(PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --libs-only-L libtiff-4)" diff --git a/libtiff.build.sh b/libtiff.build.sh index e0e8485..49cf237 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -35,6 +35,7 @@ local _conf=( # --disable-rpath --disable-shared --with-pic + --disable-jbig ) ./configure "${_conf[@]}" From ffef375d2213422e0e726779ccff66d02754e43f Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Tue, 21 Jan 2025 12:26:44 +0100 Subject: [PATCH 12/12] WIP --- libtiff.build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libtiff.build.sh b/libtiff.build.sh index 49cf237..9bf9306 100755 --- a/libtiff.build.sh +++ b/libtiff.build.sh @@ -36,6 +36,8 @@ local _conf=( --disable-shared --with-pic --disable-jbig + --disable-lerc + --disable-libdeflate ) ./configure "${_conf[@]}"