Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/tesseract/nsis/build.sh @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 #!/bin/bash | |
| 2 | |
| 3 # GitHub actions - Create Tesseract installer for Windows | |
| 4 | |
| 5 # Author: Stefan Weil (2010-2024) | |
| 6 | |
| 7 set -e | |
| 8 set -x | |
| 9 | |
| 10 LANG=C.UTF-8 | |
| 11 | |
| 12 ARCH=$1 | |
| 13 | |
| 14 if [ "$ARCH" = "i686" ]; then | |
| 15 MINGW=/mingw32 | |
| 16 else | |
| 17 ARCH=x86_64 | |
| 18 MINGW=/mingw64 | |
| 19 fi | |
| 20 | |
| 21 ROOTDIR=$PWD | |
| 22 DISTDIR=$ROOTDIR/dist | |
| 23 HOST=$ARCH-w64-mingw32 | |
| 24 TAG=$(cat VERSION).$(date +%Y%m%d) | |
| 25 BUILDDIR=bin/ndebug/$HOST-$TAG | |
| 26 PKG_ARCH=mingw-w64-${ARCH/_/-} | |
| 27 | |
| 28 # Install packages. | |
| 29 sudo apt-get update --quiet | |
| 30 sudo apt-get install --assume-yes --no-install-recommends --quiet \ | |
| 31 asciidoc curl xsltproc docbook-xml docbook-xsl \ | |
| 32 automake dpkg-dev libtool pkg-config default-jdk-headless \ | |
| 33 mingw-w64-tools nsis g++-"$PKG_ARCH" \ | |
| 34 makepkg pacman-package-manager python3-venv unzip | |
| 35 | |
| 36 # Configure pacman. | |
| 37 | |
| 38 # Enable mirrorlist. | |
| 39 sudo sed -Ei 's/^#.*(Include.*mirrorlist)/\1/' /etc/pacman.conf | |
| 40 ( | |
| 41 # Add msys key for pacman. | |
| 42 cd /usr/share/keyrings | |
| 43 sudo curl -OsS https://raw.githubusercontent.com/msys2/MSYS2-keyring/master/msys2.gpg | |
| 44 sudo curl -OsS https://raw.githubusercontent.com/msys2/MSYS2-keyring/master/msys2-revoked | |
| 45 sudo curl -OsS https://raw.githubusercontent.com/msys2/MSYS2-keyring/master/msys2-trusted | |
| 46 ) | |
| 47 ( | |
| 48 # Add active environments for pacman. | |
| 49 # See https://www.msys2.org/docs/repos-mirrors/. | |
| 50 sudo mkdir -p /etc/pacman.d | |
| 51 cd /etc/pacman.d | |
| 52 cat <<eod | sudo tee mirrorlist >/dev/null | |
| 53 [mingw64] | |
| 54 Include = /etc/pacman.d/mirrorlist.mingw | |
| 55 eod | |
| 56 sudo curl -OsS https://raw.githubusercontent.com/msys2/MSYS2-packages/master/pacman-mirrors/mirrorlist.mingw | |
| 57 # sudo curl -OsS https://raw.githubusercontent.com/msys2/MSYS2-packages/master/pacman-mirrors/mirrorlist.msys | |
| 58 ) | |
| 59 | |
| 60 sudo pacman-key --init | |
| 61 sudo pacman-key --populate msys2 | |
| 62 sudo pacman -Syu --noconfirm | |
| 63 | |
| 64 # Install required pacman packages. | |
| 65 sudo pacman -S --noconfirm \ | |
| 66 mingw-w64-x86_64-curl-winssl \ | |
| 67 mingw-w64-x86_64-giflib \ | |
| 68 mingw-w64-x86_64-icu \ | |
| 69 mingw-w64-x86_64-leptonica \ | |
| 70 mingw-w64-x86_64-libarchive \ | |
| 71 mingw-w64-x86_64-libidn2 \ | |
| 72 mingw-w64-x86_64-openjpeg2 \ | |
| 73 mingw-w64-x86_64-openssl \ | |
| 74 mingw-w64-x86_64-pango \ | |
| 75 mingw-w64-x86_64-libpng \ | |
| 76 mingw-w64-x86_64-libtiff \ | |
| 77 mingw-w64-x86_64-libwebp | |
| 78 | |
| 79 git config --global user.email "sw@weilnetz.de" | |
| 80 git config --global user.name "Stefan Weil" | |
| 81 git tag -a "v$TAG" -m "Tesseract $TAG" | |
| 82 | |
| 83 # Run autogen. | |
| 84 ./autogen.sh | |
| 85 | |
| 86 # Build Tesseract installer. | |
| 87 mkdir -p "$BUILDDIR" && cd "$BUILDDIR" | |
| 88 | |
| 89 # Run configure. | |
| 90 PKG_CONFIG_PATH=$MINGW/lib/pkgconfig | |
| 91 export PKG_CONFIG_PATH | |
| 92 # Disable OpenMP (see https://github.com/tesseract-ocr/tesseract/issues/1662). | |
| 93 ../../../configure --disable-openmp --host="$HOST" --prefix="/usr/$HOST" \ | |
| 94 CXX="$HOST-g++-posix" \ | |
| 95 CXXFLAGS="-fno-math-errno -Wall -Wextra -Wpedantic -g -O2 -isystem $MINGW/include" \ | |
| 96 LDFLAGS="-L$MINGW/lib" | |
| 97 | |
| 98 make all training | |
| 99 MINGW_INSTALL=${PWD}${MINGW} | |
| 100 make install-jars install training-install html prefix="$MINGW_INSTALL" INSTALL_STRIP_FLAG=-s | |
| 101 test -d venv || python3 -m venv venv | |
| 102 source venv/bin/activate | |
| 103 pip install pefile | |
| 104 mkdir -p dll | |
| 105 ln -sv $("$ROOTDIR/nsis/find_deps.py" "$MINGW_INSTALL"/bin/*.exe "$MINGW_INSTALL"/bin/*.dll) dll/ | |
| 106 ln -svf /usr/lib/gcc/x86_64-w64-mingw32/*-win32/libstdc++-6.dll dll/ | |
| 107 ln -svf /usr/lib/gcc/x86_64-w64-mingw32/*-win32/libgcc_s_seh-1.dll dll/ | |
| 108 make winsetup prefix="$MINGW_INSTALL" | |
| 109 | |
| 110 # Copy result for upload. | |
| 111 mkdir -p "$DISTDIR" && cp nsis/tesseract-ocr-w*-setup-*.exe "$DISTDIR" |
