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

Last change on this file since 32256 was 32256, checked in by sjm84, 6 years ago

Changes to get xpdftools compiled up on the 32 bit linux LSB, since 32 bit xpdftools binaries is what we hope to use on both 32 and 64 bit machines.

  • Property svn:executable set to *
File size: 5.8 KB
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
[32256]14# When trying to compile xpdf-tools on a 32 bit linux LSB, we get the error
15# "undefined reference to `__sync_add_and_fetch_4'" unless we follow the instructions at
16# https://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atomic-operation-in-32-bit-mode
17# and append to CXXFLAGS "-march=i486", which is the earliest architecture for which compilation
18# succeeds and the xpdftool binaries produced work (even though our 32 bit LSB is i686).
19arch=`uname -m`
20if [[ $arch = *"64"* ]]; then
21 arch=
22else
23 echo "@@@ 32 bit unix, passing in -march=i486 to avoid certain linking errors"
24 arch="-march=i486"
25fi
26
[32230]27# Use C/CPP/CXX FLAGS and LDFLAGS for further setting up
[32228]28# libpng and libz for compiling xpdftools
29export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
30export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15"
[32256]31export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 $arch"
[32228]32export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib"
[32227]33
[32248]34# See section D, 4c of the GS-README of this extension.
[32246]35if [ "x$GSDLOS" == "xdarwin" ] ; then
36 static_flag=-Bstatic
37else
38 static_flag=-static
39fi
[32227]40
41opt_run_untar $force_untar $auto_untar $package $version
42
[32249]43# patch the original tarball with our custom CMake configure/makefile
[32234]44if [[ -d "$package$version/xpdf" && -f "gs-CMakeLists.txt" ]]; then
45 echo "*******************************************************************"
[32249]46 echo "Using our custom gs-CMakeLists.txt instead of the one included in the xpdf subfolder of $package$version"
[32234]47 echo "Renaming gs-CMakeLists.txt to $package$version/xpdf/CMakeLists.txt"
48 echo "*******************************************************************"
49
50 cp "gs-CMakeLists.txt" "$package$version/xpdf/CMakeLists.txt"
51fi
52
[32227]53# Whether force_config is set for this package depends on CMake test
54# to see if 'release' directory has been created or not
55if [ $auto_config = "1" ] ; then
56 if [ ! -d $package$version/release ] ; then
57 force_config=1
58 fi
59fi
60
61echo "Using cmake: "
62echo `which cmake`
63
[32230]64# The xpdf-tools src code's INSTALL instructions say we need to create a 'build' dir,
65# cd into there and then run cmake from there, providing the xpdf-tools src dir
66# However, doing so breaks the way cascade-lib.bash runs a CMake compile sequence.
67# cascade-lib.bash wants a 'release' directory, so do it the cascade-make way as
68# that works.
[32228]69# TO AVOID building xpdf(reader), turn off finding Qt libs with the cmake flags below
[32227]70if [ $force_config = "1" ] ; then
71 echo "[pushd $package$version]"
72 ( cd $package$version ; \
73 if [ ! -d release ] ; then \
74 echo "Creating 'release' directory" ; \
75 mkdir release ; \
76 fi ; \
77 cd release ; \
78
[32230]79 # see xpdf-tools src code's INSTALL file for these options
[32227]80 if [ ! -f Makefile ] ; then \
81 #cmake -D CMAKE_BUILD_TYPE=RELEASE \
82 # -D CMAKE_INSTALL_PREFIX=$prefix ..;
83 cmake -DCMAKE_BUILD_TYPE=Release \
84 -DCMAKE_INSTALL_PREFIX=$prefix \
[32249]85 -DTIFF_INCLUDE_DIR=$prefix/include \
86 -DJPEG_INCLUDE_DIR=$prefix/include \
[32233]87 -DZLIB_LIBRARY=$prefix/lib/libz.a \
[32249]88 -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
[32233]89 -DPNG_LIBRARY=$prefix/lib/libpng15.a \
[32249]90 -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
[32235]91 -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
[32227]92 -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \
93 -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \
94 -DCMAKE_C_FLAGS="$CFLAGS" \
95 -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
96 -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
[32246]97 -DGSDLFLAG_STATIC="$static_flag" \
[32227]98 $GEXT_XPDFTOOLS/packages/$package$version
99 fi ; \
100 PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH}; \
101 export PKG_CONFIG_PATH; \
102 )
103 if [ $? != 0 ] ; then
104 echo " Error encountered running *configure* stage of $progname"
105 exit 1
106 fi
107 echo "[popd]"
108 opt_run_cmake $compile $package $version "release"
109 opt_run_cmake $install $package $version "release" "install"
110else
111 if [ $auto_config = "1" ] ; then
112 echo "Found top-level for ${progname%.*} => no need to run configure/initialize CMake"
113 fi
114fi
[32228]115
[32249]116
[32248]117## If compiling statically make sure the above CMake command contains the following
118## with these values:
[32230]119# -DZLIB_LIBRARY=$prefix/lib/libz.a \
[32249]120# -DTIFF_LIBRARY=$prefix/lib/libtiff.a \
[32230]121# -DPNG_LIBRARY=$prefix/lib/libpng15.a \
[32249]122# -DJPEG_LIBRARY=$prefix/lib/libjpeg.a \
[32230]123# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \
[32248]124# and
125# -DGSDLFLAG_STATIC="$static_flag" \
[32230]126
[32237]127
[32249]128## For building dynamic xpdf-tools executables, change the above to have the following instead
[32256]129## The .so for LIBJPEG gets generated for libjpeg version 9c (but not 6b). Correct the .so version number below.
[32228]130# -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \
[32249]131# -DTIFF_LIBRARY=$prefix/lib/libtiff.so.5.2.2 \
[32228]132# -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \
[32256]133# -DJPEG_LIBRARY=$prefix/lib/libjpeg.so.PUT_THE_NUMBER_HERE \
[32228]134# -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
[32248]135# (The 3rd line can alternatively be "-DFREETYPE_DIR=$prefix")
[32249]136# And REMOVE the following line. Don't comment it out, nor set it to "", but remove it:
[32248]137# -DGSDLFLAG_STATIC="$static_flag" \
[32228]138
[32248]139
[32228]140# If compilation was successful, then we don't need cmake binaries anymore when
[32249]141# packaging up xpdf-tools. Move them away from the distribution area:
[32239]142
143if [ -f "$GEXTXPDFTOOLS_INSTALLED/bin/pdftohtml" ]; then
144 echo "**************************************"
145 echo "Moving intermediary CMake products out of the distribution area"
146 $GEXT_XPDFTOOLS/move-cmake.sh away
147 echo "**************************************"
148fi
Note: See TracBrowser for help on using the repository browser.