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

Revision 32234, 4.5 KB (checked in by ak19, 17 months ago)

Introducing gs-CMakeLists.txt as a GS customised CMakeLists.txt to replace the one in the xpdf tools src code package once the latter's been untarred. XPDFTools.sh takes care of doing the replacement after the untar operation. Minor cleanup to CMAKE.sh

  • Property svn:executable set to *
RevLine 
[32227]1#!/bin/bash
2
3# only going to make xpdf-tools, not xpdf-reader. So not making all of xpdf
[32234]4package=xpdf
[32227]5version=-4.00
6
7progname=$0
8
9source ../cascade-make/lib/cascade-lib.bash GEXT_XPDFTOOLS ../.. $*
10
[32228]11# GEXT XDFTOOLS INSTALLED location is this GEXT's GSDLOS subdir
[32227]12prefix=$GEXTXPDFTOOLS_INSTALLED
13
[32230]14# Use C/CPP/CXX FLAGS and LDFLAGS for further setting up
[32228]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"
[32227]20
21
22opt_run_untar $force_untar $auto_untar $package $version
23
[32234]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
[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
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
[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]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
[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 \
[32232]68        -DFREETYPE_DIR=$prefix \
[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" \
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
[32228]91
[32230]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
97
98## When -DFREETYPE_DIR is used in place of -DFREETYPE_LIBRARY above, it makes
99## xpdf-tools compilation find the "libfreetype.so" (no versioning at end) in
100## our gs ext.
101## But -DZLIB_DIR and -DPNG_DIR are ignored because they go unrecognised, whereas
102## -DZLIB_LIBRARY and -DPNG_LIBRARY are recognised by XpdfTools' CMake files.
103## -DZLIB_LIBRARY and -DPNG_LIBRARY require full paths. So the first 2 lines of the
104## following won't work:
[32228]105#       -DZLIB_DIR=$prefix \
106#       -DPNG_DIR=$prefix \
107#       -DFREETYPE_DIR=$prefix \
108
[32230]109## When specified in the following way, all 3 lines are recognised (freetype, zlib,
110## png). The 3rd line can alternatively still use "-DFREETYPE_DIR=$prefix"
[32228]111#       -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
112#       -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
113#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
114
115
116# If compilation was successful, then we don't need cmake binaries anymore when
117# packaging up xpdf-tools
Note: See TracBrowser for help on using the browser.