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

Revision 32249, 5.1 KB (checked in by ak19, 12 months ago)

All the changes to incorporate libtiff and libjpeg into the xpdftools GS2 extension, to get libjpeg compiled up on 64 bit machines, and for both libs to be seen and used by xpdftools when this is built.

  • 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
[32248]21# See section D, 4c of the GS-README of this extension.
[32246]22if [ "x$GSDLOS" == "xdarwin" ] ; then
23    static_flag=-Bstatic
24else
25    static_flag=-static
26fi
[32227]27
28opt_run_untar $force_untar $auto_untar $package $version
29
[32249]30# patch the original tarball with our custom CMake configure/makefile
[32234]31if [[ -d "$package$version/xpdf" && -f "gs-CMakeLists.txt" ]]; then
32    echo "*******************************************************************"
[32249]33    echo "Using our custom gs-CMakeLists.txt instead of the one included in the xpdf subfolder of $package$version"
[32234]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
[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
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
[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]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
[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 \
[32249]72        -DTIFF_INCLUDE_DIR=$prefix/include \
73        -DJPEG_INCLUDE_DIR=$prefix/include \
[32233]74        -DZLIB_LIBRARY=$prefix/lib/libz.a \
[32249]75        -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
[32233]76        -DPNG_LIBRARY=$prefix/lib/libpng15.a \
[32249]77        -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
[32235]78        -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
[32227]79        -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \
80        -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \
81        -DCMAKE_C_FLAGS="$CFLAGS" \
82        -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
83        -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
[32246]84        -DGSDLFLAG_STATIC="$static_flag" \
[32227]85        $GEXT_XPDFTOOLS/packages/$package$version
86    fi ; \
87    PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
88    export PKG_CONFIG_PATH; \
89   )
90  if [ $? != 0 ] ; then
91      echo "      Error encountered running *configure* stage of $progname"
92      exit 1
93  fi
94  echo "[popd]"
95  opt_run_cmake $compile $package $version "release"
96  opt_run_cmake $install $package $version "release" "install"
97else
98  if [ $auto_config = "1" ] ; then
99    echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
100  fi
101fi
[32228]102
[32249]103
[32248]104## If compiling statically make sure the above CMake command contains the following
105## with these values:
[32230]106#       -DZLIB_LIBRARY=$prefix/lib/libz.a \
[32249]107#       -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
[32230]108#       -DPNG_LIBRARY=$prefix/lib/libpng15.a \
[32249]109#       -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
[32230]110#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
[32248]111# and
112#       -DGSDLFLAG_STATIC="$static_flag" \
[32230]113
[32237]114
[32249]115## For building dynamic xpdf-tools executables, change the above to have the following instead
116## (still unable get the .so for LIBJPEG generated, so could try JPEG_LIBRARY set same as above)
[32228]117#       -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
[32249]118#       -DTIFF_LIBRARY=$prefix/lib/libtiff.so.5.2.2 \
[32228]119#       -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
120#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
[32248]121# (The 3rd line can alternatively be "-DFREETYPE_DIR=$prefix")
[32249]122# And REMOVE the following line. Don't comment it out, nor set it to "", but remove it:
[32248]123#       -DGSDLFLAG_STATIC="$static_flag" \
[32228]124
[32248]125
[32228]126# If compilation was successful, then we don't need cmake binaries anymore when
[32249]127# packaging up xpdf-tools. Move them away from the distribution area:
[32239]128
129if [ -f "$GEXTXPDFTOOLS_INSTALLED/bin/pdftohtml" ]; then
130    echo "**************************************"
131    echo "Moving intermediary CMake products out of the distribution area"
132    $GEXT_XPDFTOOLS/move-cmake.sh away
133    echo "**************************************"
134fi
Note: See TracBrowser for help on using the browser.