[32227] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # only going to make xpdf-tools, not xpdf-reader. So not making all of xpdf
|
---|
[32230] | 4 | package=xpdf
|
---|
[32227] | 5 | version=-4.00
|
---|
| 6 |
|
---|
[32232] | 7 | # Suffixes to the final .so files (not the symbolic .so files)
|
---|
| 8 | # generated for zlib and libpng. We're currently up to libpng version 15, lpng15
|
---|
| 9 | zlib_so_version=1.2.7
|
---|
| 10 | libpng_so_version=15.30.0
|
---|
| 11 |
|
---|
[32227] | 12 | progname=$0
|
---|
| 13 |
|
---|
| 14 | source ../cascade-make/lib/cascade-lib.bash GEXT_XPDFTOOLS ../.. $*
|
---|
| 15 |
|
---|
[32228] | 16 | # GEXT XDFTOOLS INSTALLED location is this GEXT's GSDLOS subdir
|
---|
[32227] | 17 | prefix=$GEXTXPDFTOOLS_INSTALLED
|
---|
| 18 |
|
---|
[32230] | 19 | # Use C/CPP/CXX FLAGS and LDFLAGS for further setting up
|
---|
[32228] | 20 | # libpng and libz for compiling xpdftools
|
---|
| 21 | export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
|
---|
| 22 | export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
|
---|
| 23 | export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
|
---|
| 24 | export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib"
|
---|
[32227] | 25 |
|
---|
| 26 |
|
---|
| 27 | opt_run_untar $force_untar $auto_untar $package $version
|
---|
| 28 |
|
---|
| 29 | # Whether force_config is set for this package depends on CMake test
|
---|
| 30 | # to see if 'release' directory has been created or not
|
---|
| 31 | if [ $auto_config = "1" ] ; then
|
---|
| 32 | if [ ! -d $package$version/release ] ; then
|
---|
| 33 | force_config=1
|
---|
| 34 | fi
|
---|
| 35 | fi
|
---|
| 36 |
|
---|
| 37 | echo "Using cmake: "
|
---|
| 38 | echo `which cmake`
|
---|
| 39 |
|
---|
[32230] | 40 | # The xpdf-tools src code's INSTALL instructions say we need to create a 'build' dir,
|
---|
| 41 | # cd into there and then run cmake from there, providing the xpdf-tools src dir
|
---|
| 42 | # However, doing so breaks the way cascade-lib.bash runs a CMake compile sequence.
|
---|
| 43 | # cascade-lib.bash wants a 'release' directory, so do it the cascade-make way as
|
---|
| 44 | # that works.
|
---|
[32228] | 45 | # TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below
|
---|
[32227] | 46 | if [ $force_config = "1" ] ; then
|
---|
| 47 | echo "[pushd $package$version]"
|
---|
| 48 | ( cd $package$version ; \
|
---|
| 49 | if [ ! -d release ] ; then \
|
---|
| 50 | echo "Creating 'release' directory" ; \
|
---|
| 51 | mkdir release ; \
|
---|
| 52 | fi ; \
|
---|
| 53 | cd release ; \
|
---|
| 54 |
|
---|
[32230] | 55 | # see xpdf-tools src code's INSTALL file for these options
|
---|
[32227] | 56 | if [ ! -f Makefile ] ; then \
|
---|
| 57 | #cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
---|
| 58 | # -D CMAKE_INSTALL_PREFIX=$prefix ..;
|
---|
| 59 | cmake -DCMAKE_BUILD_TYPE=Release \
|
---|
| 60 | -DCMAKE_INSTALL_PREFIX=$prefix \
|
---|
[32232] | 61 | -DZLIB_LIBRARY=$prefix/lib/libz.so.$zlib_so_version \
|
---|
| 62 | -DPNG_LIBRARY=$prefix/lib/libpng15.so.$libpng_so_version \
|
---|
| 63 | -DFREETYPE_DIR=$prefix \
|
---|
[32227] | 64 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \
|
---|
| 65 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \
|
---|
| 66 | -DCMAKE_C_FLAGS="$CFLAGS" \
|
---|
| 67 | -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
---|
| 68 | -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
|
---|
| 69 | $GEXT_XPDFTOOLS/packages/$package$version
|
---|
| 70 | fi ; \
|
---|
| 71 | PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
|
---|
| 72 | export PKG_CONFIG_PATH; \
|
---|
| 73 | )
|
---|
| 74 | if [ $? != 0 ] ; then
|
---|
| 75 | echo " Error encountered running *configure* stage of $progname"
|
---|
| 76 | exit 1
|
---|
| 77 | fi
|
---|
| 78 | echo "[popd]"
|
---|
| 79 | opt_run_cmake $compile $package $version "release"
|
---|
| 80 | opt_run_cmake $install $package $version "release" "install"
|
---|
| 81 | else
|
---|
| 82 | if [ $auto_config = "1" ] ; then
|
---|
| 83 | echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
|
---|
| 84 | fi
|
---|
| 85 | fi
|
---|
[32228] | 86 |
|
---|
[32230] | 87 | # If compiling statically, need these above in place of the references to .so files
|
---|
| 88 | # -DZLIB_LIBRARY=$prefix/lib/libz.a \
|
---|
| 89 | # -DPNG_LIBRARY=$prefix/lib/libpng15.a \
|
---|
| 90 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | ## When -DFREETYPE_DIR is used in place of -DFREETYPE_LIBRARY above, it makes
|
---|
| 94 | ## xpdf-tools compilation find the "libfreetype.so" (no versioning at end) in
|
---|
| 95 | ## our gs ext.
|
---|
| 96 | ## But -DZLIB_DIR and -DPNG_DIR are ignored because they go unrecognised, whereas
|
---|
| 97 | ## -DZLIB_LIBRARY and -DPNG_LIBRARY are recognised by XpdfTools' CMake files.
|
---|
| 98 | ## -DZLIB_LIBRARY and -DPNG_LIBRARY require full paths. So the first 2 lines of the
|
---|
| 99 | ## following won't work:
|
---|
[32228] | 100 | # -DZLIB_DIR=$prefix \
|
---|
| 101 | # -DPNG_DIR=$prefix \
|
---|
| 102 | # -DFREETYPE_DIR=$prefix \
|
---|
| 103 |
|
---|
[32230] | 104 | ## When specified in the following way, all 3 lines are recognised (freetype, zlib,
|
---|
| 105 | ## png). The 3rd line can alternatively still use "-DFREETYPE_DIR=$prefix"
|
---|
[32228] | 106 | # -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
|
---|
| 107 | # -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
|
---|
| 108 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | # If compilation was successful, then we don't need cmake binaries anymore when
|
---|
| 112 | # packaging up xpdf-tools
|
---|