Ignore:
Timestamp:
2018-07-06T19:19:28+12:00 (6 years ago)
Author:
ak19
Message:

I'm unable so far to get xpdf-tools to build statically on the mac. These are the changes to get it to build on the Mac in an attempt to make static xpdf-tools binaries. Running otool minus L on the binaries however shows that they're linking to dylib dlls, albeit our ones for freetype, libpng and zlib.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh

    r32240 r32246  
    1919export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib"
    2020
     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.
     28if [ "x$GSDLOS" == "xdarwin" ] ; then
     29    static_flag=-Bstatic
     30else
     31    static_flag=-static
     32fi
    2133
    2234opt_run_untar $force_untar $auto_untar $package $version
     
    7284        -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
    7385        -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
    74         -DGSDLFLAG_STATIC_BUILD="true" \
     86        -DGSDLFLAG_STATIC="$static_flag" \
    7587        $GEXT_XPDFTOOLS/packages/$package$version
    7688    fi ; \
     
    95107#       -DPNG_LIBRARY=$prefix/lib/libpng15.a \
    96108#       -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
    98110# In place of FREETYPE_LIBRARY, could also try the following (then check built bins
    99111# by running ldd and file over them):
     
    118130#       -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \
    119131# 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)
     132# pass in -DGSDLFLAG_STATIC_BUILD="..." (remove the line, don't comment it out, nor
     133# set the value to "")
    122134
    123135# If compilation was successful, then we don't need cmake binaries anymore when
Note: See TracChangeset for help on using the changeset viewer.