root/gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh @ 32235

Revision 32235, 4.6 KB (checked in by ak19, 2 years ago)

This commit doesn't fix the current problem of some statically built binaries not running (for example, pdftohtml doesn't work vs pdftotext works). However, this commits a line present in my active version which wasn't in the commit folder of the last revision concerning xpdftools compilation.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# only going to make xpdf-tools, not xpdf-reader. So not making all of xpdf
4package=xpdf
5version=-4.00
6
7progname=$0
8
9source ../cascade-make/lib/cascade-lib.bash GEXT_XPDFTOOLS ../.. $*
10
11# GEXT XDFTOOLS INSTALLED location is this GEXT's GSDLOS subdir
12prefix=$GEXTXPDFTOOLS_INSTALLED
13
14# Use C/CPP/CXX FLAGS and LDFLAGS for further setting up
15# libpng and libz for compiling xpdftools
16export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
17export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
18export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
19export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib"
20
21
22opt_run_untar $force_untar $auto_untar $package $version
23
24# patch the original tarball with our custom makefile?
25if [[ -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"
32fi
33
34# Whether force_config is set for this package depends on CMake test
35# to see if 'release' directory has been created or not
36if [ $auto_config = "1" ] ; then
37  if [ ! -d $package$version/release ] ; then
38    force_config=1
39  fi
40fi
41
42echo "Using cmake: "
43echo `which cmake`
44
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.
50# TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below
51if [ $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
60    # see xpdf-tools src code's INSTALL file for these options
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 \
66        -DZLIB_LIBRARY=$prefix/lib/libz.a \
67        -DPNG_LIBRARY=$prefix/lib/libpng15.a \
68        -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
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" \
74        $GEXT_XPDFTOOLS/packages/$package$version
75    fi ; \
76    PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
77    export PKG_CONFIG_PATH; \
78   )
79  if [ $? != 0 ] ; then
80      echo "      Error encountered running *configure* stage of $progname"
81      exit 1
82  fi
83  echo "[popd]"
84  opt_run_cmake $compile $package $version "release"
85  opt_run_cmake $install $package $version "release" "install"
86else
87  if [ $auto_config = "1" ] ; then
88    echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
89  fi
90fi
91
92# If compiling statically, need these above in place of the references to .so files
93#       -DZLIB_LIBRARY=$prefix/lib/libz.a \
94#       -DPNG_LIBRARY=$prefix/lib/libpng15.a \
95#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
96# else, in place of FREETYPE_LIBRARY:
97##      -DFREETYPE_DIR=$prefix \
98
99## When -DFREETYPE_DIR is used in place of -DFREETYPE_LIBRARY above, it makes
100## xpdf-tools compilation find the "libfreetype.so" (no versioning at end) in
101## our gs ext.
102## But -DZLIB_DIR and -DPNG_DIR are ignored because they go unrecognised, whereas
103## -DZLIB_LIBRARY and -DPNG_LIBRARY are recognised by XpdfTools' CMake files.
104## -DZLIB_LIBRARY and -DPNG_LIBRARY require full paths. So the first 2 lines of the
105## following won't work:
106#       -DZLIB_DIR=$prefix \
107#       -DPNG_DIR=$prefix \
108#       -DFREETYPE_DIR=$prefix \
109
110## When specified in the following way, all 3 lines are recognised (freetype, zlib,
111## png). The 3rd line can alternatively still use "-DFREETYPE_DIR=$prefix"
112#       -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
113#       -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
114#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
115
116
117# If compilation was successful, then we don't need cmake binaries anymore when
118# packaging up xpdf-tools
Note: See TracBrowser for help on using the browser.