Changeset 32246 for gs2-extensions/xpdf-tools
- Timestamp:
- 2018-07-06T19:19:28+12:00 (6 years ago)
- Location:
- gs2-extensions/xpdf-tools/trunk/src/packages
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh
r32240 r32246 19 19 export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib" 20 20 21 # For Mac OSX, when -static is passed in for linking, we end up with the error "ld: library not found for -lcrt0.o" 22 # See https://stackoverflow.com/questions/3801011/ld-library-not-found-for-lcrt0-o-on-osx-10-6-with-gcc-clang-static-flag 23 # On Mac OSX, compile it with -Bstatic instead, as per https://stackoverflow.com/questions/844819/how-to-static-link-on-os-x 24 # We will pass in the correct static variant as the custom GSDLFLAG_STATIC, so it will be set to either "-static" (for linux) 25 # or "-Bstatic" for darwin when CMake starts compiling up xpdf-tools. When the GSDLFLAG_STATIC is set, it will also trigger 26 # the branch of the gs-CMakeLists.txt code that does static compiling. If not set, xpdf-tools are compiled against dynamically 27 # linked libraries. 28 if [ "x$GSDLOS" == "xdarwin" ] ; then 29 static_flag=-Bstatic 30 else 31 static_flag=-static 32 fi 21 33 22 34 opt_run_untar $force_untar $auto_untar $package $version … … 72 84 -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ 73 85 -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \ 74 -DGSDLFLAG_STATIC_BUILD="true" \86 -DGSDLFLAG_STATIC="$static_flag" \ 75 87 $GEXT_XPDFTOOLS/packages/$package$version 76 88 fi ; \ … … 95 107 # -DPNG_LIBRARY=$prefix/lib/libpng15.a \ 96 108 # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \ 97 # And throw in -DGSDLFLAG_STATIC_BUILD=" true"109 # And throw in -DGSDLFLAG_STATIC_BUILD="-static" for linux or with "-Bstatic" for Macs 98 110 # In place of FREETYPE_LIBRARY, could also try the following (then check built bins 99 111 # by running ldd and file over them): … … 118 130 # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \ 119 131 # 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, nor121 # set the value to false)132 # pass in -DGSDLFLAG_STATIC_BUILD="..." (remove the line, don't comment it out, nor 133 # set the value to "") 122 134 123 135 # If compilation was successful, then we don't need cmake binaries anymore when -
gs2-extensions/xpdf-tools/trunk/src/packages/gs-CMakeLists.txt
r32244 r32246 20 20 include_directories("${PROJECT_SOURCE_DIR}/splash") 21 21 22 if(GSDLFLAG_STATIC_BUILD) 23 message(STATUS "@@@@ GSDLFLAG_STATIC_BUILD SET. Building xpdf-tools statically.") 24 else () 25 message(STATUS "@@@@ GSDLFLAG_STATIC_BUILD not SET. Building dynamically using xpdf-tools' (mostly) original, unmodified linker flags.") 22 23 # For Mac OSX, when -static is passed in for linking, we end up with the error "ld: library not found for -lcrt0.o" 24 # See https://stackoverflow.com/questions/3801011/ld-library-not-found-for-lcrt0-o-on-osx-10-6-with-gcc-clang-static-flag 25 # On Mac OSX, compile it with -Bstatic, as per https://stackoverflow.com/questions/844819/how-to-static-link-on-os-x 26 # XPDFTOOLS.sh will have set the GSDLFLAG_STATIC to either "-static" (for linux) or "-Bstatic" for darwin 27 28 if(GSDLFLAG_STATIC) 29 message(STATUS "@@@@ GSDLFLAG_STATIC SET. Building xpdf-tools statically.") 30 else () 31 message(STATUS "@@@@ GSDLFLAG_STATIC not SET. Building dynamically using xpdf-tools' (mostly) original, unmodified linker flags.") 26 32 endif () 27 33 if (PNG_FOUND) … … 41 47 include_directories("${LCMS_INCLUDE_DIR}") 42 48 set(COLOR_MANAGER_SOURCE "ColorManager.cc") 43 if(GSDLFLAG_STATIC _BUILD)49 if(GSDLFLAG_STATIC) 44 50 # Untested combination, warn https://cmake.org/cmake/help/v3.0/command/message.html 45 message(AUTHOR_WARNING "@@@@@@@@@@@@@@@ GSDL Warning: static building with HAVE_LCMS on. If running ldd/file on generated binaries shows any binary to be partially a dynamic executable, then Export VERBOSE=1 and re-run the CMake build. Then check the verbose build output's linker flags (for static building) for that binary: they should not be -Wl,-Bstatic LIBS -Wl,-Bdynamic -lpthread but -static LIBS. Fix it by removing all references to LCMS_LIBRARY in the static linking flags of target_link_libraries statements (i.e. when GSDLFLAG_STATIC _BUILDis set) in file gs-CMakeLists.txt and replacing them with the -l equivalent for the color manager library, (l)cms. @@@@@@@@@@@@@@@")51 message(AUTHOR_WARNING "@@@@@@@@@@@@@@@ GSDL Warning: static building with HAVE_LCMS on. If running ldd/file on generated binaries shows any binary to be partially a dynamic executable, then Export VERBOSE=1 and re-run the CMake build. Then check the verbose build output's linker flags (for static building) for that binary: they should not be -Wl,-Bstatic LIBS -Wl,-Bdynamic -lpthread but -static LIBS. Fix it by removing all references to LCMS_LIBRARY in the static linking flags of target_link_libraries statements (i.e. when GSDLFLAG_STATIC is set) in file gs-CMakeLists.txt and replacing them with the -l equivalent for the color manager library, (l)cms. @@@@@@@@@@@@@@@") 46 52 endif () 47 53 else () … … 49 55 endif () 50 56 if (DTYPE_LIBRARY) 51 if(GSDLFLAG_STATIC _BUILD)57 if(GSDLFLAG_STATIC) 52 58 # Untested combination, warn 53 message(AUTHOR_WARNING "@@@@@@@@@@@@@@@ GSDL Warning: static building with TYPE_LIBRARY. If running ldd/file on generated binaries shows any binary to be partially a dynamic executable, then export VERBOSE=1 and re-run the CMake build. Then check the verbose build output's linker flags (for static building) for that binary: they should not be -Wl,-Bstatic LIBS -Wl,-Bdynamic -lpthread but -static LIBS. Fix it by removing all references to DTYPE_LIBRARY in the static linking flags of target_link_libraries statements (i.e. when GSDLFLAG_STATIC _BUILDis set) in file gs-CMakeLists.txt and replacing them with the -l equivalent for typelib. @@@@@@@@@@@@@@@")59 message(AUTHOR_WARNING "@@@@@@@@@@@@@@@ GSDL Warning: static building with TYPE_LIBRARY. If running ldd/file on generated binaries shows any binary to be partially a dynamic executable, then export VERBOSE=1 and re-run the CMake build. Then check the verbose build output's linker flags (for static building) for that binary: they should not be -Wl,-Bstatic LIBS -Wl,-Bdynamic -lpthread but -static LIBS. Fix it by removing all references to DTYPE_LIBRARY in the static linking flags of target_link_libraries statements (i.e. when GSDLFLAG_STATIC is set) in file gs-CMakeLists.txt and replacing them with the -l equivalent for typelib. @@@@@@@@@@@@@@@") 54 60 endif () 55 61 endif () … … 154 160 pdftops.cc 155 161 ) 156 if(GSDLFLAG_STATIC _BUILD)162 if(GSDLFLAG_STATIC) 157 163 target_link_libraries(pdftops goo fofi splash 158 -static-lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lz -lm -lc -lpthread)164 ${GSDLFLAG_STATIC} -lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lz -lm -lc -lpthread) 159 165 # Threads::Threads instead of -lpthread results in a partially dynamic executable 160 166 else () … … 172 178 pdftops.cc 173 179 ) 174 if(GSDLFLAG_STATIC _BUILD)175 target_link_libraries(pdftops goo fofi -static${LCMS_LIBRARY} -lm -lc -lpthread)180 if(GSDLFLAG_STATIC) 181 target_link_libraries(pdftops goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lm -lc -lpthread) 176 182 else () 177 183 target_link_libraries(pdftops goo fofi ${LCMS_LIBRARY}) … … 188 194 pdftotext.cc 189 195 ) 190 if(GSDLFLAG_STATIC _BUILD)191 target_link_libraries(pdftotext goo fofi -static${LCMS_LIBRARY} -lpthread)196 if(GSDLFLAG_STATIC) 197 target_link_libraries(pdftotext goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lpthread) 192 198 # Threads::Threads instead of -lpthread results in a partially dynamic executable 193 199 else () … … 207 213 pdftohtml.cc 208 214 ) 209 if(GSDLFLAG_STATIC _BUILD)215 if(GSDLFLAG_STATIC) 210 216 target_link_libraries(pdftohtml goo fofi splash 211 -static-lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lpng -lz -lm -lc -lpthread)217 ${GSDLFLAG_STATIC} -lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lpng -lz -lm -lc -lpthread) 212 218 else () 213 219 target_link_libraries(pdftohtml goo fofi splash … … 227 233 # The order of dynamic .so files listed by ldd in the broken binary differs from 228 234 # a manually linked working version of pdftohtml, and seems to be the only difference 229 # between the two in ldd output. Not using "-Wl,-Bstatic" and using -static in its230 # place creates a partially static dynamic executable that isn't broken, whereas235 # between the two in ldd output. Not using "-Wl,-Bstatic" and using -static (-Bstatic on Mac) 236 # in its place creates a partially static dynamic executable that isn't broken, whereas 231 237 # additionally removing "-Wl,-Bdynamic -lpthread" and replacing it with -lpthread 232 238 # moreover produces a working pdftohtml that is a fully static linked executable. … … 247 253 pdfinfo.cc 248 254 ) 249 if(GSDLFLAG_STATIC _BUILD)250 target_link_libraries(pdfinfo goo fofi -static${LCMS_LIBRARY} -lpthread)255 if(GSDLFLAG_STATIC) 256 target_link_libraries(pdfinfo goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lpthread) 251 257 else () 252 258 target_link_libraries(pdfinfo goo fofi ${LCMS_LIBRARY}) … … 261 267 pdffonts.cc 262 268 ) 263 if(GSDLFLAG_STATIC _BUILD)264 target_link_libraries(pdffonts goo fofi -static${LCMS_LIBRARY} -lpthread)269 if(GSDLFLAG_STATIC) 270 target_link_libraries(pdffonts goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lpthread) 265 271 else () 266 272 target_link_libraries(pdffonts goo fofi ${LCMS_LIBRARY}) … … 275 281 pdfdetach.cc 276 282 ) 277 if(GSDLFLAG_STATIC _BUILD)278 target_link_libraries(pdfdetach goo fofi -static${LCMS_LIBRARY} -lpthread)283 if(GSDLFLAG_STATIC) 284 target_link_libraries(pdfdetach goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lpthread) 279 285 else () 280 286 target_link_libraries(pdfdetach goo fofi ${LCMS_LIBRARY}) … … 291 297 pdftoppm.cc 292 298 ) 293 if(GSDLFLAG_STATIC _BUILD)299 if(GSDLFLAG_STATIC) 294 300 target_link_libraries(pdftoppm goo fofi splash 295 -static-lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lz -lm -lc -lpthread)301 ${GSDLFLAG_STATIC} -lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lz -lm -lc -lpthread) 296 302 else () 297 303 target_link_libraries(pdftoppm goo fofi splash … … 313 319 pdftopng.cc 314 320 ) 315 if(GSDLFLAG_STATIC _BUILD)321 if(GSDLFLAG_STATIC) 316 322 target_link_libraries(pdftopng goo fofi splash 317 -static-lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lpng -lz -lm -lc -lpthread)323 ${GSDLFLAG_STATIC} -lfreetype ${DTYPE_LIBRARY} ${LCMS_LIBRARY} -lpng -lz -lm -lc -lpthread) 318 324 else () 319 325 target_link_libraries(pdftopng goo fofi splash … … 333 339 pdfimages.cc 334 340 ) 335 if(GSDLFLAG_STATIC _BUILD)336 target_link_libraries(pdfimages goo fofi -static${LCMS_LIBRARY} -lpthread)341 if(GSDLFLAG_STATIC) 342 target_link_libraries(pdfimages goo fofi ${GSDLFLAG_STATIC} ${LCMS_LIBRARY} -lpthread) 337 343 else () 338 344 target_link_libraries(pdfimages goo fofi ${LCMS_LIBRARY})
Note:
See TracChangeset
for help on using the changeset viewer.