Fix OSX compile and deploy
authorromibi <romibi@bluewin.ch>
Fri, 1 Sep 2017 08:06:10 +0000 (10:06 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 4 Feb 2018 22:55:46 +0000 (23:55 +0100)
Set additional compile flag
Fix FindLdap.cmake for OSX
Fix DMG creation (sometimes fails if no volume size is provided)

Closes GH-304.

.travis.yml
cmake/FindLdap.cmake
cmake/QuasselCompileSettings.cmake
scripts/build/macosx_makePackage.sh

index 5ce83c6..42fae1f 100644 (file)
@@ -1,6 +1,5 @@
 os:
   - linux
 os:
   - linux
-  - osx
 
 sudo: required
 dist: trusty
 
 sudo: required
 dist: trusty
@@ -17,13 +16,13 @@ env:
   - QT_VERSION=qt5
 
 matrix:
   - QT_VERSION=qt5
 
 matrix:
+  include:
+    - os: osx
+      compiler: gcc
+      env: QT_VERSION=qt5
   exclude:
     - compiler: clang
       env: QT_VERSION=qt4
   exclude:
     - compiler: clang
       env: QT_VERSION=qt4
-    - os: osx
-      compiler: clang
-    - os: osx
-      env: QT_VERSION=qt4
 
 install: |-
   if [ "$TRAVIS_OS_NAME" == "linux" ]
 
 install: |-
   if [ "$TRAVIS_OS_NAME" == "linux" ]
@@ -50,13 +49,12 @@ script: |-
     make
   elif [ "$TRAVIS_OS_NAME" == "osx" ]
   then
     make
   elif [ "$TRAVIS_OS_NAME" == "osx" ]
   then
+    PATH=$PATH:/usr/local/opt/qt5/bin
     if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]
     then
     if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]
     then
-      PATH=$PATH:/usr/local/opt/qt5/bin
-      # The LDAP headers found in OSX Frameworks seem to be broken
-      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DLDAP_INCLUDE_DIR=/usr/include/
+      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON
     else
     else
-      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DLDAP_INCLUDE_DIR=/usr/include/
+      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release
     fi
     ninja install
   fi
     fi
     ninja install
   fi
index 5532547..2c96fae 100644 (file)
@@ -15,7 +15,22 @@ endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
 
 # Attempt to link against ldap.h regardless of platform!
 FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
 
 # Attempt to link against ldap.h regardless of platform!
 FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
+
+# If we detect path to invalid ldap.h on osx, try /usr/include/
+# This might also be achievable with additional parameters to FIND_PATH.
+string(TOLOWER ${LDAP_INCLUDE_DIR} ldapincludelower)
+if("${ldapincludelower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework\\/headers")
+  set(LDAP_INCLUDE_DIR "/usr/include/")
+endif()
+
 FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
 FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
+
+# On osx remove invalid ldap.h
+string(TOLOWER ${LDAP_LIBRARIES} ldaplower)
+if("${ldaplower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework")
+  set(LDAP_LIBRARIES FALSE)
+endif()
+
 FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
 
 # It'd be nice to link against winldap on Windows, unfortunately
 FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
 
 # It'd be nice to link against winldap on Windows, unfortunately
index 905f669..68fccdc 100644 (file)
@@ -80,6 +80,5 @@ endif()
 # Mac build stuff
 if (APPLE AND DEPLOY)
     set(CMAKE_OSX_ARCHITECTURES "x86_64")
 # Mac build stuff
 if (APPLE AND DEPLOY)
     set(CMAKE_OSX_ARCHITECTURES "x86_64")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9")
-    set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9 -stdlib=libc++")
 endif()
 endif()
index 05a1cd2..4f41171 100755 (executable)
@@ -80,5 +80,6 @@ case $BUILDTYPE in
        exit 1
        ;;
 esac
        exit 1
        ;;
 esac
-hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
+PACKAGESIZE=$(echo "$(du -ms ${PACKAGETMPDIR} | cut -f1) * 1.1" | bc)
+hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -size ${PACKAGESIZE}M -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
 rm -rf ${PACKAGETMPDIR}
 rm -rf ${PACKAGETMPDIR}