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

Last change on this file since 32249 was 32249, checked in by ak19, 6 years 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 *
File size: 5.1 KB
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 CMake configure/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 the xpdf subfolder of $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 -DTIFF_INCLUDE_DIR=$prefix/include \
73 -DJPEG_INCLUDE_DIR=$prefix/include \
74 -DZLIB_LIBRARY=$prefix/lib/libz.a \
75 -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
76 -DPNG_LIBRARY=$prefix/lib/libpng15.a \
77 -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
78 -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
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" \
84 -DGSDLFLAG_STATIC="$static_flag" \
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
102
103
104## If compiling statically make sure the above CMake command contains the following
105## with these values:
106# -DZLIB_LIBRARY=$prefix/lib/libz.a \
107# -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
108# -DPNG_LIBRARY=$prefix/lib/libpng15.a \
109# -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
110# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
111# and
112# -DGSDLFLAG_STATIC="$static_flag" \
113
114
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)
117# -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
118# -DTIFF_LIBRARY=$prefix/lib/libtiff.so.5.2.2 \
119# -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
120# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
121# (The 3rd line can alternatively be "-DFREETYPE_DIR=$prefix")
122# And REMOVE the following line. Don't comment it out, nor set it to "", but remove it:
123# -DGSDLFLAG_STATIC="$static_flag" \
124
125
126# If compilation was successful, then we don't need cmake binaries anymore when
127# packaging up xpdf-tools. Move them away from the distribution area:
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 repository browser.