From d4e05d61c1309ac6debdf47e84d8c3d543b0830b Mon Sep 17 00:00:00 2001 From: HumanDynamo Date: Thu, 18 Jun 2015 07:58:52 +0000 Subject: [PATCH] add Macports support with cmake and coverity analyzer --- bootstrap.linux | 6 ++-- bootstrap.macports | 83 +++++++++++++++++++++++++++++++++++++++++++++ contrib/coverity.sh | 26 ++++++++------ 3 files changed, 102 insertions(+), 13 deletions(-) create mode 100755 bootstrap.macports diff --git a/bootstrap.linux b/bootstrap.linux index db7b76a9..fee180ff 100755 --- a/bootstrap.linux +++ b/bootstrap.linux @@ -8,11 +8,11 @@ # We will work on command line using GNU Make export MAKEFILES_TYPE='Unix Makefiles' -if [ ! -d "build" ]; then - mkdir build +if [ ! -d "build.cmake" ]; then + mkdir build.cmake fi -cd build +cd build.cmake cmake -G "$MAKEFILES_TYPE" . \ -DCMAKE_BUILD_TYPE=debugfull \ diff --git a/bootstrap.macports b/bootstrap.macports new file mode 100755 index 00000000..bace4b81 --- /dev/null +++ b/bootstrap.macports @@ -0,0 +1,83 @@ +#!/bin/sh + +# Copyright (c) 2008-2015, Gilles Caulier, +# +# 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}" \ + -DEXIV2_ENABLE_SHARED=ON \ + -DEXIV2_ENABLE_XMP=ON \ + -DEXIV2_ENABLE_LIBXMP=ON \ + -DEXIV2_ENABLE_VIDEO=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 \ + -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" \ + -DBUNDLE_INSTALL_DIR=${BUNDLE_INSTALL_DIR} \ + -DQT_QT_INCLUDE_DIR=${INSTALL_PREFIX}/include \ + -DQT_LIBRARY_DIR=${INSTALL_PREFIX}/lib \ + -DQT_QMAKE_EXECUTABLE=${INSTALL_PREFIX}/bin/qmake \ + .. diff --git a/contrib/coverity.sh b/contrib/coverity.sh index bdccb206..9ceb4da3 100755 --- a/contrib/coverity.sh +++ b/contrib/coverity.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2013, Gilles Caulier, +# Copyright (c) 2013-2015, Gilles Caulier, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. @@ -17,19 +17,26 @@ cd .. # Manage build sub-dir -if [ -d "build" ]; then - rm -rfv ./build +if [ -d "build.cmake" ]; then + rm -rfv ./build.cmake fi -./bootstrap.linux +if [[ "$OSTYPE" == "linux-gnu" ]]; then + ./bootstrap.linux +elif [[ "$OSTYPE" == "darwin"* ]]; then + ./bootstrap.macports +else + echo "Unsupported platform..." + exit -1 +fi # Get active svn branch path to create SCAN import description string -svn info | grep "URL" | sed '/svn/{s/.*\(svn.*\)/\1/};' > ./build/svn_branch.txt -desc=$( ./build.cmake/svn_branch.txt +desc=$( /dev/null echo "Done. Coverity Scan tarball 'myproject.tgz' is uploaded and ready for analyse."