[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 |
|
---|
[32248] | 21 | # See section D, 4c of the GS-README of this extension.
|
---|
[32246] | 22 | if [ "x$GSDLOS" == "xdarwin" ] ; then
|
---|
| 23 | static_flag=-Bstatic
|
---|
| 24 | else
|
---|
| 25 | static_flag=-static
|
---|
| 26 | fi
|
---|
[32227] | 27 |
|
---|
| 28 | opt_run_untar $force_untar $auto_untar $package $version
|
---|
| 29 |
|
---|
[32234] | 30 | # patch the original tarball with our custom makefile?
|
---|
| 31 | if [[ -d "$package$version/xpdf" && -f "gs-CMakeLists.txt" ]]; then
|
---|
| 32 | echo "*******************************************************************"
|
---|
| 33 | echo "Using our custom gs-CMakeLists.txt instead of the one included in $package$version"
|
---|
| 34 | echo "Renaming gs-CMakeLists.txt to $package$version/xpdf/CMakeLists.txt"
|
---|
| 35 | echo "*******************************************************************"
|
---|
| 36 |
|
---|
| 37 | cp "gs-CMakeLists.txt" "$package$version/xpdf/CMakeLists.txt"
|
---|
| 38 | fi
|
---|
| 39 |
|
---|
[32227] | 40 | # Whether force_config is set for this package depends on CMake test
|
---|
| 41 | # to see if 'release' directory has been created or not
|
---|
| 42 | if [ $auto_config = "1" ] ; then
|
---|
| 43 | if [ ! -d $package$version/release ] ; then
|
---|
| 44 | force_config=1
|
---|
| 45 | fi
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 | echo "Using cmake: "
|
---|
| 49 | echo `which cmake`
|
---|
| 50 |
|
---|
[32230] | 51 | # The xpdf-tools src code's INSTALL instructions say we need to create a 'build' dir,
|
---|
| 52 | # cd into there and then run cmake from there, providing the xpdf-tools src dir
|
---|
| 53 | # However, doing so breaks the way cascade-lib.bash runs a CMake compile sequence.
|
---|
| 54 | # cascade-lib.bash wants a 'release' directory, so do it the cascade-make way as
|
---|
| 55 | # that works.
|
---|
[32228] | 56 | # TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below
|
---|
[32227] | 57 | if [ $force_config = "1" ] ; then
|
---|
| 58 | echo "[pushd $package$version]"
|
---|
| 59 | ( cd $package$version ; \
|
---|
| 60 | if [ ! -d release ] ; then \
|
---|
| 61 | echo "Creating 'release' directory" ; \
|
---|
| 62 | mkdir release ; \
|
---|
| 63 | fi ; \
|
---|
| 64 | cd release ; \
|
---|
| 65 |
|
---|
[32230] | 66 | # see xpdf-tools src code's INSTALL file for these options
|
---|
[32227] | 67 | if [ ! -f Makefile ] ; then \
|
---|
| 68 | #cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
---|
| 69 | # -D CMAKE_INSTALL_PREFIX=$prefix ..;
|
---|
| 70 | cmake -DCMAKE_BUILD_TYPE=Release \
|
---|
| 71 | -DCMAKE_INSTALL_PREFIX=$prefix \
|
---|
[32233] | 72 | -DZLIB_LIBRARY=$prefix/lib/libz.a \
|
---|
| 73 | -DPNG_LIBRARY=$prefix/lib/libpng15.a \
|
---|
[32235] | 74 | -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
|
---|
[32227] | 75 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \
|
---|
| 76 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \
|
---|
| 77 | -DCMAKE_C_FLAGS="$CFLAGS" \
|
---|
| 78 | -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
---|
| 79 | -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
|
---|
[32246] | 80 | -DGSDLFLAG_STATIC="$static_flag" \
|
---|
[32227] | 81 | $GEXT_XPDFTOOLS/packages/$package$version
|
---|
| 82 | fi ; \
|
---|
| 83 | PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
|
---|
| 84 | export PKG_CONFIG_PATH; \
|
---|
| 85 | )
|
---|
| 86 | if [ $? != 0 ] ; then
|
---|
| 87 | echo " Error encountered running *configure* stage of $progname"
|
---|
| 88 | exit 1
|
---|
| 89 | fi
|
---|
| 90 | echo "[popd]"
|
---|
| 91 | opt_run_cmake $compile $package $version "release"
|
---|
| 92 | opt_run_cmake $install $package $version "release" "install"
|
---|
| 93 | else
|
---|
| 94 | if [ $auto_config = "1" ] ; then
|
---|
| 95 | echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
|
---|
| 96 | fi
|
---|
| 97 | fi
|
---|
[32228] | 98 |
|
---|
[32248] | 99 | ## If compiling statically make sure the above CMake command contains the following
|
---|
| 100 | ## with these values:
|
---|
[32230] | 101 | # -DZLIB_LIBRARY=$prefix/lib/libz.a \
|
---|
| 102 | # -DPNG_LIBRARY=$prefix/lib/libpng15.a \
|
---|
| 103 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
|
---|
[32248] | 104 | # and
|
---|
| 105 | # -DGSDLFLAG_STATIC="$static_flag" \
|
---|
[32230] | 106 |
|
---|
[32237] | 107 |
|
---|
[32248] | 108 | ## For building dynamic xpdf-tools executables, change the above to have the following instead:
|
---|
[32228] | 109 | # -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
|
---|
| 110 | # -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
|
---|
| 111 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
|
---|
[32248] | 112 | # (The 3rd line can alternatively be "-DFREETYPE_DIR=$prefix")
|
---|
| 113 | # And remove the following line. Don't comment it out, nor set it to "", but remove it:
|
---|
| 114 | # -DGSDLFLAG_STATIC="$static_flag" \
|
---|
[32228] | 115 |
|
---|
[32248] | 116 |
|
---|
[32228] | 117 | # If compilation was successful, then we don't need cmake binaries anymore when
|
---|
| 118 | # packaging up xpdf-tools
|
---|
[32239] | 119 |
|
---|
| 120 | if [ -f "$GEXTXPDFTOOLS_INSTALLED/bin/pdftohtml" ]; then
|
---|
| 121 | echo "**************************************"
|
---|
| 122 | echo "Moving intermediary CMake products out of the distribution area"
|
---|
| 123 | $GEXT_XPDFTOOLS/move-cmake.sh away
|
---|
| 124 | echo "**************************************"
|
---|
| 125 | fi
|
---|