From 5d6cae1ae7e0c026e6ff227905b7738f91dbcc16 Mon Sep 17 00:00:00 2001
From: Andreas Naumann <andreas.naumann@tu-dresden.de>
Date: Tue, 14 Dec 2010 16:05:07 +0000
Subject: [PATCH] directory creation for debs

---
 AMDiS/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++
 AMDiS/postrm         |  1 +
 AMDiS/postrm.in      | 10 ++++++++++
 AMDiS/preinst        |  6 ++++++
 AMDiS/preinst.in     |  9 +++++++++
 5 files changed, 57 insertions(+)
 create mode 100755 AMDiS/postrm
 create mode 100644 AMDiS/postrm.in
 create mode 100755 AMDiS/preinst
 create mode 100755 AMDiS/preinst.in

diff --git a/AMDiS/CMakeLists.txt b/AMDiS/CMakeLists.txt
index 6addf593..4a44b80d 100644
--- a/AMDiS/CMakeLists.txt
+++ b/AMDiS/CMakeLists.txt
@@ -263,27 +263,39 @@ if(ENABLE_MARMOT)
 	Message("please set marmotcc manually")
 endif(ENABLE_MARMOT)
 
+set(deb_add_dirs "lib/amdis")
 install(TARGETS amdis compositeFEM 
 	LIBRARY DESTINATION lib/amdis/ )
 
 FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
 INSTALL(FILES ${HEADERS} 
 	DESTINATION include/amdis/)
+list(APPEND deb_add_dirs "include/amdis")
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
 INSTALL(FILES ${HEADERS} 
 	DESTINATION include/amdis/)
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h")
 INSTALL(FILES ${HEADERS} 
 	DESTINATION include/amdis/parallel/)
+list(APPEND deb_add_dirs "include/amdis/parallel")
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
 INSTALL(FILES ${HEADERS} 
 	DESTINATION include/amdis/time/)
+list(APPEND deb_add_dirs "include/amdis/time")
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/itl/*.hpp")
 INSTALL(FILES ${HEADERS} 
 	DESTINATION include/amdis/itl)
+list(APPEND deb_add_dirs "include/amdis/itl")
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
 INSTALL(FILES ${HEADERS}
 	DESTINATION include/amdis/io)
+list(APPEND deb_add_dirs "include/amdis/io")
+
 FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
 INSTALL(FILES ${HEADERS}
 	DESTINATION include/amdis/io)
@@ -294,6 +306,8 @@ configure_file(${AMDiS_SOURCE_DIR}/AMDiSConfig.cmake.in
 	      )
 INSTALL(FILES ${AMDiS_BINARY_DIR}/AMDiSConfig.cmake 
 	DESTINATION share/amdis/)
+list(APPEND deb_add_dirs "share/amdis/")
+
 INSTALL(FILES ${AMDiS_SOURCE_DIR}/AMDiSUse.cmake 
 	DESTINATION share/amdis/)
 
@@ -306,6 +320,14 @@ INSTALL(DIRECTORY ${AMDiS_SOURCE_DIR}/lib/mtl4/
 	PATTERN "mtl4/libs" EXCLUDE
 	PATTERN "mtl4/extern" EXCLUDE
        )
+FILE(GLOB_RECURSE mtl4_files 
+		RELATIVE ${AMDiS_SOURCE_DIR}/lib/mtl4/boost/ 
+		${AMDiS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
+foreach(mtl4_file in ${mtl4_files})
+ get_filename_component(mtl4File_path ${mtl4_file} PATH)
+ list(APPEND deb_add_dirs "include/amdis/mtl4/${mtl4File_path}")
+endforeach(mtl4_file)
+list(REMOVE_DUPLICATES deb_add_dirs)
 
 #PACKAGES
 #let cmake look for the svn-version
@@ -323,8 +345,17 @@ set(CPACK_PACKAGE_VERSION "0.9.${CurrentRevision}")
 set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
 set(CPACK_INSTALL_PREFIX "/usr/")
 
+configure_file(${AMDiS_SOURCE_DIR}/preinst.in 
+  ${AMDiS_BINARY_DIR}/preinst 
+  @ONLY)
+
+configure_file(${AMDiS_SOURCE_DIR}/postrm.in 
+  ${AMDiS_BINARY_DIR}/postrm 
+  @ONLY)
 set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= 1.42, ${RPM_DEPEND_STR}")
 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.42)")
+set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${AMDiS_BINARY_DIR}/preinst" "${AMDiS_BINARY_DIR}/postrm")
+
 include(CPack)
 if(ENABLE_TESTS)
 ENABLE_TESTING()
diff --git a/AMDiS/postrm b/AMDiS/postrm
new file mode 100755
index 00000000..1a248525
--- /dev/null
+++ b/AMDiS/postrm
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/AMDiS/postrm.in b/AMDiS/postrm.in
new file mode 100644
index 00000000..f774705b
--- /dev/null
+++ b/AMDiS/postrm.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+NEWDIRS_SEMI="@deb_add_dirs@"
+NEWDIRS=`echo ${NEWDIRS_SEMI} | sed 's/;/ /g'`
+BASEDIR=@CPACK_INSTALL_PREFIX@
+#echo "will create the remove directories:"
+for d in ${NEWDIRS}; do
+#  echo "${BASEDIR}${d}"
+   rm -rf ${BASEDIR}${d}
+done
+
diff --git a/AMDiS/preinst b/AMDiS/preinst
new file mode 100755
index 00000000..1ebf99f2
--- /dev/null
+++ b/AMDiS/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+NEWDIRS="lib/amdis;include/amdis;include/amdis/parallel;include/amdis/time;include/amdis/itl;include/amdis/io;share/amdis/;include/amdis/mtl4/;include/amdis/mtl4/property_map/traits;include/amdis/mtl4/property_map;include/amdis/mtl4/property_map;include/amdis/mtl4/property_map;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/recursion;include/amdis/mtl4/numeric/mtl/io;include/amdis/mtl4/numeric/mtl/io;include/amdis/mtl4/numeric/mtl/io;include/amdis/mtl4/numeric/mtl/io;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/detail;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/utility;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/concept;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/draft;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation/opteron;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/operation;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl/matrix;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl/interface;include/amdis/mtl4/numeric/mtl/interface;include/amdis/mtl4/numeric/mtl/interface;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl/vector;include/amdis/mtl4/numeric/mtl;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/linear_algebra;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/krylov;include/amdis/mtl4/numeric/itl/iteration;include/amdis/mtl4/numeric/itl/iteration;include/amdis/mtl4/numeric/itl/iteration;include/amdis/mtl4/numeric/itl;include/amdis/mtl4/numeric/itl/smoother;include/amdis/mtl4/numeric/itl/utility;include/amdis/mtl4/numeric/itl/utility;include/amdis/mtl4/numeric/itl;include/amdis/mtl4/numeric/itl/pc;include/amdis/mtl4/numeric/itl/pc;include/amdis/mtl4/numeric/itl/pc;include/amdis/mtl4/numeric/itl/pc;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/numeric/meta_math;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence/detail;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence;include/amdis/mtl4/sequence/algorithm;include/amdis/mtl4/sequence/algorithm;include/amdis/mtl4/sequence/algorithm/unrolled;include/amdis/mtl4/sequence/algorithm/unrolled;include/amdis/mtl4/sequence/algorithm;include/amdis/mtl4/sequence;include/amdis/mtl4/detail;include/amdis/mtl4/detail;include/amdis/mtl4/detail;include/amdis/mtl4/config"
+echo "will create the following directories:"
+for d in ${NEWDIRS}; do
+  echo "${d}"
+done
diff --git a/AMDiS/preinst.in b/AMDiS/preinst.in
new file mode 100755
index 00000000..ad8a5a0f
--- /dev/null
+++ b/AMDiS/preinst.in
@@ -0,0 +1,9 @@
+#!/bin/sh
+NEWDIRS_SEMI="@deb_add_dirs@"
+NEWDIRS=`echo ${NEWDIRS_SEMI} | sed 's/;/ /g'`
+BASEDIR=@CPACK_INSTALL_PREFIX@
+#echo "will create the following directories:"
+for d in ${NEWDIRS}; do
+#  echo "${BASEDIR}${d}"
+  mkdir --parents ${BASEDIR}${d}
+done
-- 
GitLab