]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added cpack configuration, and Mac Bundle package.
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 14 Nov 2014 09:37:16 +0000 (10:37 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 9 Dec 2014 13:37:21 +0000 (14:37 +0100)
CMakeLists.txt
cmake/setup_cached_variables.cmake
cpack/CMakeLists.txt [new file with mode: 0644]
cpack/mac-bundle/Info.plist [new file with mode: 0644]
cpack/mac-bundle/dealii-icon.icns [new file with mode: 0644]
cpack/mac-bundle/dealii-terminal [new file with mode: 0755]
cpack/mac-bundle/dealii.conf [new file with mode: 0644]
cpack/mac-bundle/dealii.location [new file with mode: 0644]
cpack/mac-bundle/mac_startup_script.sh [new file with mode: 0755]

index 8bfac59aeeb301d026ebf3108a3ac306807650bf..3367111b1f98b3893df25bc2e0456b54385404e9 100644 (file)
@@ -163,6 +163,8 @@ IF(DEAL_II_HAVE_TESTS_DIRECTORY AND NOT DEAL_II_MSVC)
   ADD_SUBDIRECTORY(tests)
 ENDIF()
 
+ADD_SUBDIRECTORY(cpack)
+
 #
 # And finally, print the configuration:
 #
index a6e66b63ae65f8d80cd63f1c359d7e65ab79d703..3269a0293af6c9bf2e94b33f0040f5b4c97e2f36 100644 (file)
@@ -27,6 +27,7 @@
 #     DEAL_II_COMPONENT_EXAMPLES
 #     DEAL_II_COMPONENT_MESH_CONVERTER
 #     DEAL_II_COMPONENT_PARAMETER_GUI
+#     DEAL_II_COMPONENT_PACKAGE
 #     DEAL_II_FORCE_AUTODETECTION
 #
 # Options regarding compilation and linking:
@@ -111,6 +112,10 @@ OPTION(DEAL_II_FORCE_AUTODETECTION
   OFF
   )
 
+OPTION(DEAL_II_COMPONENT_PACKAGE
+  "Generates additional targets for packaging deal.II"
+  OFF
+  )
 
 
 ########################################################################
diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt
new file mode 100644 (file)
index 0000000..717a8d1
--- /dev/null
@@ -0,0 +1,47 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2012 - 2014 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+IF(DEAL_II_COMPONENT_PACKAGE)
+  MESSAGE(STATUS "Setting up CPack")
+  SET(CPACK_GENERATOR "Bundle")
+
+  SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cpack/mac-bundle/dealii-icon.icns")
+  set(CPACK_PACKAGE_FILE_NAME "${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION}")
+  set(CPACK_BUNDLE_NAME "${DEAL_II_PACKAGE_NAME}")
+  SET(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/cpack/mac-bundle/dealii-icon.icns")
+  SET(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/cpack/mac-bundle/Info.plist")
+  SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_SOURCE_DIR}/cpack/mac-bundle/mac_startup_script.sh")
+
+  INSTALL(FILES ${CMAKE_SOURCE_DIR}/cpack/mac-bundle/dealii.conf DESTINATION etc/)
+  INSTALL(FILES ${CMAKE_SOURCE_DIR}/cpack/mac-bundle/dealii.location DESTINATION etc/)
+  INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/cpack/mac-bundle/dealii-terminal DESTINATION bin/)
+
+  OPTION(DEAL_II_INSTALLS_EXTERNAL_LIBS
+         "Install external libraries together with deal.II."
+         OFF
+  )
+
+  IF(DEAL_II_INSTALLS_EXTERNAL_LIBS)
+    SET(DEAL_II_EXTERNAL_LIBS_TREE "NOT_SET" CACHE PATH
+       "Path to tree of external libraries that will be installed in bundle package."
+    )
+    INSTALL(DIRECTORY ${DEAL_II_EXTERNAL_LIBS_TREE}/ 
+            DESTINATION opt
+            USE_SOURCE_PERMISSIONS)
+  ENDIF()
+
+  INCLUDE(CPack)
+  MESSAGE(STATUS "Setting up CPack - Done")
+ENDIF()
diff --git a/cpack/mac-bundle/Info.plist b/cpack/mac-bundle/Info.plist
new file mode 100644 (file)
index 0000000..e662555
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>deal.II</string>
+       <key>CFBundleGetInfoString</key>
+       <string>8.2.pre</string>
+       <key>CFBundleIconFile</key>
+       <string>deal.II</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.dealii</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>8.2.pre</string>
+       <key>CFBundleSignature</key>
+       <string>deal.II</string>
+       <key>CFBundleVersion</key>
+       <string>8.2.pre</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>GPL</string>
+       <key>LSMinimumSystemVersion</key>
+       <string>10.9</string>
+</dict>
+</plist>
diff --git a/cpack/mac-bundle/dealii-icon.icns b/cpack/mac-bundle/dealii-icon.icns
new file mode 100644 (file)
index 0000000..cda670c
Binary files /dev/null and b/cpack/mac-bundle/dealii-icon.icns differ
diff --git a/cpack/mac-bundle/dealii-terminal b/cpack/mac-bundle/dealii-terminal
new file mode 100755 (executable)
index 0000000..9fb4533
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+if [ "$BASH_SOURCE" == "$0" ]
+then
+  export DEAL_II_BUNDLE=`echo "$0" | sed -e 's|/Contents/.*||'`
+  export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+else
+  export DEAL_II_BUNDLE=`echo "$BASH_SOURCE" | sed -e 's|/Contents/MacOS/.*||'`
+  export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+fi
+
+# Make sure DEAL_II_BUNDLE is set correctly
+if [ -z "$DEAL_II_BUNDLE" ]; then 
+    export DEAL_II_BUNDLE=/Applications/deal.II.app
+    if [ ! -d $DEAL_II_BUNDLE ]; then 
+           return=`/usr/bin/osascript <<EOF
+tell app "System Events"
+    Activate
+    display dialog "This commands need to know where you installed the deal.II appliaction. If you moved it or renamed it, and you want to run this script from the command line, export the variable DEAL_II_BUNDLE to the correct path." buttons "OK" default button 1 with title "Location of deal.II changed." with icon 0
+end tell
+EOF`
+    exit 1
+    fi
+fi
+
+if [ -z "$DEAL_II_RESOURCES" ]; then 
+    export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+fi
+
+# Make sure XCode is installed
+if ! [[ -x /usr/bin/xcodebuild ]]; then
+    return=`/usr/bin/osascript <<EOF
+tell app "System Events"
+    Activate
+    display dialog "This package requires XCode to be installed in order to run. Please install XCode from the OS X install disc and try again." buttons "OK" default button 1 with title "XCode Missing" with icon 0
+end tell
+EOF`
+    exit 1
+fi
+
+# Everything seems to be okay. Launch a terminal with PATH's
+# set up to work with deal.II.
+CONF=$DEAL_II_RESOURCES/etc/dealii.conf
+
+if ! [[ -f $CONF ]]; then
+    return=`/usr/bin/osascript <<EOF
+tell app "System Events"
+    Activate
+    display dialog "I could not find the file $CONF. Make sure your deal.II app is installed correctly." buttons "OK" default button 1 with title "XCode Missing" with icon 0
+end tell
+EOF`
+    exit 1
+fi
+/bin/bash --rcfile $CONF -i
diff --git a/cpack/mac-bundle/dealii.conf b/cpack/mac-bundle/dealii.conf
new file mode 100644 (file)
index 0000000..4dcc1c7
--- /dev/null
@@ -0,0 +1,71 @@
+# Make sure DEAL_II_BUNDLE is set correctly
+if [ -z "$DEAL_II_BUNDLE" ]; then 
+    export DEAL_II_BUNDLE=/Applications/deal.II.app
+    if [ ! -d $DEAL_II_BUNDLE ]; then 
+    cat << EOF
+*** Warning: I did not find the deal.II installation in $DEAL_II_BUNDLE. 
+    Could not set the environment to work with deal.II. Either reinstall 
+    or set the environment vairiable DEAL_II_BUNDLE to the correct value.
+    Things may not work as you expect if you continue.
+EOF
+    fi
+fi
+
+# Check if DEAL_II_RESOURCES is set, otherwise set it to the default
+if [ -z "$DEAL_II_RESOURCES" ]; then 
+    export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+fi
+
+# Start with default compilers libraries
+export PATH=$DEAL_II_RESOURCES/bin:$PATH
+export DYLD_LIBRARY_PATH=$DEAL_II_RESOURCES/lib:$DYLD_LIBRARY_PATH
+export DEAL_II_DIR=$DEAL_II_RESOURCES
+
+# Do wathever the external library tells us to
+if [ -f $DEAL_II_RESOURCES/opt/external.conf ]; then
+    . $DEAL_II_RESOURCES/opt/external.conf
+fi
+
+if [ -z "$DEAL_II_CONF_SILENT" ]; then
+    # Clear screen
+    clear
+
+    # Set prompt
+    # export PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\W\$ \[\033[00m\]"
+
+    # Set terminal title
+    # echo -n -e "\033]0;deal.II - an open source finite element library DEAL_II \007"
+
+    cat << EOF
+       ______           _  _____ _____ 
+       |  _  \         | ||_   _|_   _|
+       | | | |___  __ _| |  | |   | |  
+       | | | / _ \/ _| | |  | |   | |  
+       | |/ /  __/ (_| | |__| |_ _| |_ 
+       |___/ \___|\__,_|_(_)___/ \___/ 
+                                
+This is a shell with PATH's and DYLD_LIBRARY_PATH setup to work with Deal.II. 
+If you are new to Deal.II you probably want to have a look at 
+
+    $DEAL_II_RESOURCES/examples/
+
+For more information please visit the project website: 
+
+http://www.dealii.org
+
+If you want to set up your daily Terminal to work with deal.II, add 
+these lines to your ~/.profile file (the first line turns off this message):
+  
+   export DEAL_II_CONF_SILENT=ON
+   . $DEAL_II_RESOURCES/etc/dealii.conf
+
+EOF
+fi
+
+if ! [[ -x /usr/bin/xcodebuild ]]; then
+    cat << EOF
+*** Warning: This package requires XCode to be installed in order to run.
+    Please install XCode from the OS X install disc before you continue.
+
+EOF
+fi
diff --git a/cpack/mac-bundle/dealii.location b/cpack/mac-bundle/dealii.location
new file mode 100644 (file)
index 0000000..b0910fa
--- /dev/null
@@ -0,0 +1 @@
+/Applications/deal.II.app
diff --git a/cpack/mac-bundle/mac_startup_script.sh b/cpack/mac-bundle/mac_startup_script.sh
new file mode 100755 (executable)
index 0000000..b98aabd
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+function relocate_if_necessary {
+    # If necessary, we relocate the libraries and binaries to the new place, 
+    # by calling install_name_tool on each library in the installation tree
+    OLD=`cat $1/Contents/Resources/etc/dealii.location`
+    if [ ! "$OLD"=="$1" ];then
+       echo $1 > $1/Contents/Resources/etc/dealii.location
+       echo Needs relocation from $OLD to $1!
+    fi  
+    return
+}
+
+if [ "$BASH_SOURCE" == "$0" ]
+then
+  export DEAL_II_BUNDLE=`echo "$0" | sed -e 's|/Contents/MacOS/.*||'`
+  export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+  open -a /Applications/Utilities/Terminal.app $DEAL_II_RESOURCES/bin/dealii-terminal
+else
+  export DEAL_II_BUNDLE=`echo "$BASH_SOURCE" | sed -e 's|/Contents/MacOS/.*||'`
+  export DEAL_II_RESOURCES=$DEAL_II_BUNDLE/Contents/Resources
+  source $DEAL_II_RESOURCES/etc/dealii.conf
+fi

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.