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

Last change on this file since 32240 was 32240, checked in by ak19, 6 years ago

Forgot to cleanup a couple of things before the previous commit

  • Property svn:executable set to *
File size: 5.2 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
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 -DGSDLFLAG_STATIC_BUILD="true" \
75 $GEXT_XPDFTOOLS/packages/$package$version
76 fi ; \
77 PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
78 export PKG_CONFIG_PATH; \
79 )
80 if [ $? != 0 ] ; then
81 echo " Error encountered running *configure* stage of $progname"
82 exit 1
83 fi
84 echo "[popd]"
85 opt_run_cmake $compile $package $version "release"
86 opt_run_cmake $install $package $version "release" "install"
87else
88 if [ $auto_config = "1" ] ; then
89 echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
90 fi
91fi
92
93# If compiling statically, need these above in place of the references to .so files
94# -DZLIB_LIBRARY=$prefix/lib/libz.a \
95# -DPNG_LIBRARY=$prefix/lib/libpng15.a \
96# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
97# And throw in -DGSDLFLAG_STATIC_BUILD="true"
98# In place of FREETYPE_LIBRARY, could also try the following (then check built bins
99# by running ldd and file over them):
100## -DFREETYPE_DIR=$prefix \
101
102
103## When -DFREETYPE_DIR is used in place of -DFREETYPE_LIBRARY above, it makes
104## xpdf-tools compilation find the "libfreetype.so" (no versioning at end) in
105## our gs ext.
106## But -DZLIB_DIR and -DPNG_DIR are ignored because they go unrecognised, whereas
107## -DZLIB_LIBRARY and -DPNG_LIBRARY are recognised by XpdfTools' CMake files.
108## -DZLIB_LIBRARY and -DPNG_LIBRARY require full paths. So the first 2 lines of the
109## following won't work:
110# -DZLIB_DIR=$prefix \
111# -DPNG_DIR=$prefix \
112# -DFREETYPE_DIR=$prefix \
113
114## When specified in the following way, all 3 lines are recognised (freetype, zlib,
115## png). The 3rd line can alternatively still use "-DFREETYPE_DIR=$prefix"
116# -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
117# -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
118# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
119# The above is for building dynamic xpdf-tools executables. For which, also don't
120# pass in -DGSDLFLAG_STATIC_BUILD="true" (remove the line, don't comment it out, nor
121# set the value to false)
122
123# If compilation was successful, then we don't need cmake binaries anymore when
124# packaging up xpdf-tools
125
126if [ -f "$GEXTXPDFTOOLS_INSTALLED/bin/pdftohtml" ]; then
127 echo "**************************************"
128 echo "Moving intermediary CMake products out of the distribution area"
129 $GEXT_XPDFTOOLS/move-cmake.sh away
130 echo "**************************************"
131fi
Note: See TracBrowser for help on using the repository browser.