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

Revision 32248, 4.6 KB (checked in by ak19, 11 months ago)

1. Overhaul to the GS-README for the xpdf-tools extension. 2. Moved a lot of verbose comments that explain reasonings behind doing things from gs-CMakeLists.txt and somewhat from XPDFTOOLS.sh

  • 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# See section D, 4c of the GS-README of this extension.
22if [ "x$GSDLOS" == "xdarwin" ] ; then
23    static_flag=-Bstatic
24else
25    static_flag=-static
26fi
27
28opt_run_untar $force_untar $auto_untar $package $version
29
30# patch the original tarball with our custom makefile?
31if [[ -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"
38fi
39
40# Whether force_config is set for this package depends on CMake test
41# to see if 'release' directory has been created or not
42if [ $auto_config = "1" ] ; then
43  if [ ! -d $package$version/release ] ; then
44    force_config=1
45  fi
46fi
47
48echo "Using cmake: "
49echo `which cmake`
50
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.
56# TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below
57if [ $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
66    # see xpdf-tools src code's INSTALL file for these options
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 \
72        -DZLIB_LIBRARY=$prefix/lib/libz.a \
73        -DPNG_LIBRARY=$prefix/lib/libpng15.a \
74        -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
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" \
80        -DGSDLFLAG_STATIC="$static_flag" \
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"
93else
94  if [ $auto_config = "1" ] ; then
95    echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
96  fi
97fi
98
99## If compiling statically make sure the above CMake command contains the following
100## with these values:
101#       -DZLIB_LIBRARY=$prefix/lib/libz.a \
102#       -DPNG_LIBRARY=$prefix/lib/libpng15.a \
103#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
104# and
105#       -DGSDLFLAG_STATIC="$static_flag" \
106
107
108## For building dynamic xpdf-tools executables, change the above to have the following instead:
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 \
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" \
115
116
117# If compilation was successful, then we don't need cmake binaries anymore when
118# packaging up xpdf-tools
119
120if [ -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 "**************************************"
125fi
Note: See TracBrowser for help on using the browser.