1 | #!/bin/bash |
---|
2 | |
---|
3 | # only going to make xpdf-tools, not xpdf-reader. So not making all of xpdf |
---|
4 | package=xpdf |
---|
5 | version=-4.00 |
---|
6 | |
---|
7 | progname=$0 |
---|
8 | |
---|
9 | source ../cascade-make/lib/cascade-lib.bash GEXT_XPDFTOOLS ../.. $* |
---|
10 | |
---|
11 | # GEXT XDFTOOLS INSTALLED location is this GEXT's GSDLOS subdir |
---|
12 | prefix=$GEXTXPDFTOOLS_INSTALLED |
---|
13 | |
---|
14 | # Use C/CPP/CXX FLAGS and LDFLAGS for further setting up |
---|
15 | # libpng and libz for compiling xpdftools |
---|
16 | export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" |
---|
17 | export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" |
---|
18 | export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" |
---|
19 | export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib" |
---|
20 | |
---|
21 | |
---|
22 | opt_run_untar $force_untar $auto_untar $package $version |
---|
23 | |
---|
24 | # Whether force_config is set for this package depends on CMake test |
---|
25 | # to see if 'release' directory has been created or not |
---|
26 | if [ $auto_config = "1" ] ; then |
---|
27 | if [ ! -d $package$version/release ] ; then |
---|
28 | force_config=1 |
---|
29 | fi |
---|
30 | fi |
---|
31 | |
---|
32 | echo "Using cmake: " |
---|
33 | echo `which cmake` |
---|
34 | |
---|
35 | # The xpdf-tools src code's INSTALL instructions say we need to create a 'build' dir, |
---|
36 | # cd into there and then run cmake from there, providing the xpdf-tools src dir |
---|
37 | # However, doing so breaks the way cascade-lib.bash runs a CMake compile sequence. |
---|
38 | # cascade-lib.bash wants a 'release' directory, so do it the cascade-make way as |
---|
39 | # that works. |
---|
40 | # TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below |
---|
41 | if [ $force_config = "1" ] ; then |
---|
42 | echo "[pushd $package$version]" |
---|
43 | ( cd $package$version ; \ |
---|
44 | if [ ! -d release ] ; then \ |
---|
45 | echo "Creating 'release' directory" ; \ |
---|
46 | mkdir release ; \ |
---|
47 | fi ; \ |
---|
48 | cd release ; \ |
---|
49 | |
---|
50 | # see xpdf-tools src code's INSTALL file for these options |
---|
51 | if [ ! -f Makefile ] ; then \ |
---|
52 | #cmake -D CMAKE_BUILD_TYPE=RELEASE \ |
---|
53 | # -D CMAKE_INSTALL_PREFIX=$prefix ..; |
---|
54 | cmake -DCMAKE_BUILD_TYPE=Release \ |
---|
55 | -DCMAKE_INSTALL_PREFIX=$prefix \ |
---|
56 | -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \ |
---|
57 | -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \ |
---|
58 | -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \ |
---|
59 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \ |
---|
60 | -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \ |
---|
61 | -DCMAKE_C_FLAGS="$CFLAGS" \ |
---|
62 | -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ |
---|
63 | -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \ |
---|
64 | $GEXT_XPDFTOOLS/packages/$package$version |
---|
65 | fi ; \ |
---|
66 | PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \ |
---|
67 | export PKG_CONFIG_PATH; \ |
---|
68 | ) |
---|
69 | if [ $? != 0 ] ; then |
---|
70 | echo " Error encountered running *configure* stage of $progname" |
---|
71 | exit 1 |
---|
72 | fi |
---|
73 | echo "[popd]" |
---|
74 | opt_run_cmake $compile $package $version "release" |
---|
75 | opt_run_cmake $install $package $version "release" "install" |
---|
76 | else |
---|
77 | if [ $auto_config = "1" ] ; then |
---|
78 | echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake" |
---|
79 | fi |
---|
80 | fi |
---|
81 | |
---|
82 | # If compiling statically, need these above in place of the references to .so files |
---|
83 | # -DZLIB_LIBRARY=$prefix/lib/libz.a \ |
---|
84 | # -DPNG_LIBRARY=$prefix/lib/libpng15.a \ |
---|
85 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \ |
---|
86 | |
---|
87 | |
---|
88 | ## When -DFREETYPE_DIR is used in place of -DFREETYPE_LIBRARY above, it makes |
---|
89 | ## xpdf-tools compilation find the "libfreetype.so" (no versioning at end) in |
---|
90 | ## our gs ext. |
---|
91 | ## But -DZLIB_DIR and -DPNG_DIR are ignored because they go unrecognised, whereas |
---|
92 | ## -DZLIB_LIBRARY and -DPNG_LIBRARY are recognised by XpdfTools' CMake files. |
---|
93 | ## -DZLIB_LIBRARY and -DPNG_LIBRARY require full paths. So the first 2 lines of the |
---|
94 | ## following won't work: |
---|
95 | # -DZLIB_DIR=$prefix \ |
---|
96 | # -DPNG_DIR=$prefix \ |
---|
97 | # -DFREETYPE_DIR=$prefix \ |
---|
98 | |
---|
99 | ## When specified in the following way, all 3 lines are recognised (freetype, zlib, |
---|
100 | ## png). The 3rd line can alternatively still use "-DFREETYPE_DIR=$prefix" |
---|
101 | # -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \ |
---|
102 | # -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \ |
---|
103 | # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \ |
---|
104 | |
---|
105 | |
---|
106 | # If compilation was successful, then we don't need cmake binaries anymore when |
---|
107 | # packaging up xpdf-tools |
---|