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