89 lines
3.7 KiB
Bash
89 lines
3.7 KiB
Bash
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
# The prepare function is executed in the root of the temp directory
|
|
# This function is used for putting downloaded files to the correct location or applying patches
|
|
prepare() {
|
|
cd "$BPM_SOURCE"
|
|
# Apply patch for additional install targets
|
|
patch -Np1 -i "$BPM_WORKDIR"/mupdf-install-targets.patch
|
|
# Apply patch for clang 21
|
|
patch -Np1 -i "$BPM_WORKDIR"/mupdf-clang21.patch
|
|
|
|
# Setup make configuration
|
|
cat > user.make <<-EOF
|
|
USE_SYSTEM_LIBS := yes
|
|
USE_SYSTEM_FREETYPE := yes
|
|
USE_SYSTEM_HARFBUZZ := yes
|
|
USE_SYSTEM_JBIG2DEC := no
|
|
USE_SYSTEM_JPEGXR := no
|
|
USE_SYSTEM_LCMS2 := no
|
|
USE_SYSTEM_LIBJPEG := yes
|
|
USE_SYSTEM_MUJS := no
|
|
USE_SYSTEM_OPENJPEG := yes
|
|
USE_SYSTEM_ZLIB := yes
|
|
USE_SYSTEM_GLUT := yes
|
|
USE_SYSTEM_CURL := yes
|
|
USE_SYSTEM_GUMBO := no
|
|
EOF
|
|
}
|
|
|
|
# The build function is executed in the source directory
|
|
# This function is used to compile the source code
|
|
build() {
|
|
export XCFLAGS=-fPIC
|
|
|
|
make -j1 VENV_FLAG= shared=yes verbose=yes build=release libs apps extra-apps c++ python
|
|
}
|
|
|
|
# The package function is executed in the source directory
|
|
# This function is used to move the compiled files into the output directory
|
|
package_mupdf() {
|
|
install -Dm755 build/shared-release/mupdf-x11 "$BPM_OUTPUT"/usr/bin/mupdf
|
|
install -Dm644 docs/man/mupdf.1 "$BPM_OUTPUT"/usr/share/man/man1/mupdf.1
|
|
install -Dm644 README "$BPM_OUTPUT"/usr/share/doc/mupdf/README
|
|
install -Dm644 CHANGES "$BPM_OUTPUT"/usr/share/doc/mupdf/CHANGES
|
|
install -Dm644 COPYING "$BPM_OUTPUT"/usr/share/doc/mupdf/COPYING
|
|
install -Dm644 "$BPM_WORKDIR"/mupdf.desktop "$BPM_OUTPUT"/usr/share/applications/mupdf.desktop
|
|
install -Dm644 "$BPM_WORKDIR"/mupdf.xpm "$BPM_OUTPUT"/usr/share/pixmaps/mupdf.xpm
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/mupdf/COPYING
|
|
}
|
|
|
|
package_mupdf-gl() {
|
|
install -Dm755 build/shared-release/mupdf-gl "$BPM_OUTPUT"/usr/bin/mupdf
|
|
install -Dm644 docs/man/mupdf.1 "$BPM_OUTPUT"/usr/share/man/man1/mupdf.1
|
|
install -Dm644 README "$BPM_OUTPUT"/usr/share/doc/mupdf/README
|
|
install -Dm644 CHANGES "$BPM_OUTPUT"/usr/share/doc/mupdf/CHANGES
|
|
install -Dm644 COPYING "$BPM_OUTPUT"/usr/share/doc/mupdf/COPYING
|
|
install -Dm644 "$BPM_WORKDIR"/mupdf.desktop "$BPM_OUTPUT"/usr/share/applications/mupdf.desktop
|
|
install -Dm644 "$BPM_WORKDIR"/mupdf.xpm "$BPM_OUTPUT"/usr/share/pixmaps/mupdf.xpm
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/mupdf/COPYING
|
|
}
|
|
|
|
package_mupdf-tools() {
|
|
install -Dm755 build/shared-release/mupdf-x11-curl "$BPM_OUTPUT"/usr/bin/mupdf-x11-curl
|
|
install -Dm755 build/shared-release/mutool "$BPM_OUTPUT"/usr/bin/mutool
|
|
install -Dm755 build/shared-release/muraster "$BPM_OUTPUT"/usr/bin/muraster
|
|
install -Dm644 docs/man/mutool.1 "$BPM_OUTPUT"/usr/share/man/man1/mutool.1
|
|
install -Dm644 README "$BPM_OUTPUT"/usr/share/doc/mupdf-tools/README
|
|
install -Dm644 CHANGES "$BPM_OUTPUT"/usr/share/doc/mupdf-tools/CHANGES
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/mupdf/COPYING
|
|
}
|
|
|
|
package_libmupdf() {
|
|
make prefix=/usr DESTDIR="$BPM_OUTPUT" SO_INSTALL_MODE=755 install-shared-c install-shared-c++
|
|
|
|
# Install pkgconfig file
|
|
install -Dm644 "$BPM_WORKDIR"/mupdf.pc "$BPM_OUTPUT"/usr/lib/pkgconfig/mupdf.pc
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/mupdf/COPYING
|
|
}
|