bootstrap.macports 2.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
#!/bin/sh

# Copyright (c) 2008-2015, Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# Arguments : $1 : install path '/opt/local' (default).
#             $2 : build type   'debugfull' to hack (default), 'release' for production.
#             $3 : target type  'x86_64' for OSX Lion and later (default), 'i386' for Snow Leopard.
#             $4 : extra CXX flags (empty by default)
#

INSTALL_PREFIX=$1
if [ "$INSTALL_PREFIX" = "" ]; then
    # Standard Macports install
    INSTALL_PREFIX=/opt/local
    BUNDLE_INSTALL_DIR=/Applications/
else
    # Specific install path as /opt/exiv2 to build bundle PKG for example
    BUNDLE_INSTALL_DIR=${INSTALL_PREFIX}/Applications/
fi

BUILD_TYPE=$2
if [ "$BUILD_TYPE" = "" ]; then
    BUILD_TYPE=debugfull
fi

TARGET_TYPE=$3
if [ "$TARGET_TYPE" = "" ]; then
    TARGET_TYPE=x86_64
fi

EXTRA_CXX_FLAGS=$4

# Set devel env from MacOS-X through MacPorts
export QTDIR=${INSTALL_PREFIX}/lib
export QT_INCLUDE_DIR=${INSTALL_PREFIX}/include
export PATH=$QTDIR/bin:$PATH
export PKG_CONFIG_PATH=${INSTALL_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH

# We will work on command line using GNU make
export MAKEFILES_TYPE='Unix Makefiles'

echo "Installing to $INSTALL_PREFIX for target $TARGET_TYPE with build mode $BUILD_TYPE and extra CXX flags $EXTRA_CXX_FLAGS"

if [ ! -d "build.cmake" ]; then
    mkdir build.cmake
fi

cd build.cmake

cmake -G "$MAKEFILES_TYPE" . \
      -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
      -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
      -DCMAKE_OSX_ARCHITECTURES=${TARGET_TYPE} \
      -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}" \
      -DCMAKE_COLOR_MAKEFILE=ON \
      -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
      -DCMAKE_INSTALL_NAME_DIR=${INSTALL_PREFIX}/lib \
      -DCMAKE_SYSTEM_PREFIX_PATH="${INSTALL_PREFIX};/usr" \
      -DCMAKE_MODULE_PATH="${INSTALL_PREFIX}/share/cmake/modules" \
      -DEXIV2_ENABLE_SHARED=ON \
      -DEXIV2_ENABLE_XMP=ON \
      -DEXIV2_ENABLE_LIBXMP=ON \
      -DEXIV2_ENABLE_PNG=ON \
      -DEXIV2_ENABLE_NLS=ON \
      -DEXIV2_ENABLE_PRINTUCS2=ON \
      -DEXIV2_ENABLE_LENSDATA=ON \
      -DEXIV2_ENABLE_COMMERCIAL=OFF \
      -DEXIV2_ENABLE_BUILD_SAMPLES=ON \
      -DEXIV2_ENABLE_BUILD_PO=ON \
      -DEXIV2_ENABLE_VIDEO=ON \
      -DEXIV2_ENABLE_WEBREADY=ON \
      -DEXIV2_ENABLE_CURL=ON \
      -DEXIV2_ENABLE_SSH=ON \
      -Wno-dev \
      ..