From: Roland Mas <roland.mas@entierement.net>
Date: Fri, 3 Dec 2021 21:56:50 +0100
Subject: Include debian.cmake

---
 cmake/Modules/MCUtil.cmake | 71 +---------------------------------------------
 1 file changed, 1 insertion(+), 70 deletions(-)

diff --git a/cmake/Modules/MCUtil.cmake b/cmake/Modules/MCUtil.cmake
index e3cdaa2..3354b99 100644
--- a/cmake/Modules/MCUtil.cmake
+++ b/cmake/Modules/MCUtil.cmake
@@ -254,78 +254,9 @@ macro(setupMCCODE FLAVOR)
       set(CPACK_NSIS_CREATE_ICONS "CreateShortCut '$DESKTOP\\\\${MCCODE_PREFIX}gui-${MCCODE_VERSION}.lnk' '${CPACK_NSIS_INSTALL_ROOT}\\\\${DEST_BINDIR}\\\\${MCCODE_PREFIX}guistart.bat' ")
      set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$DESKTOP\\\\${FLAVOR}-shell-${MCCODE_VERSION}.lnk' '${CPACK_NSIS_INSTALL_ROOT}\\\\${DEST_BINDIR}\\\\${FLAVOR}go.bat' ")
     endif()
-  else()
-  
-  # Have CMake respect install prefix
-  message(STATUS "Install prefix -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
-  set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-  set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-
-  set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
-
-  # Avoid e.g. /usr/local being "part" of the RPMs
-  set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
-    ${CMAKE_INSTALL_PREFIX}
-    ${CMAKE_INSTALL_PREFIX}/${FLAVOR}
-    ${CMAKE_INSTALL_PREFIX}/${FLAVOR}/${MCCODE_VERSION}
-    ${DEST_BINDIR}
-    ${DEST_TOOLDIR}
-    ${DEST_DATADIR_LIBDIR}
-    ${DEST_DATADIR_CODEFILES}
-    )
-
-  # Add "-VERSION" to all program files (executables)
-  set(PROGRAM_SUFFIX "-${MCCODE_VERSION}")
-
-  # Run postinst and postrm scripts for various platforms
-  set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "work/support/postinst;work/support/postrm")
-  set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/work/support/postinst;")
-  set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/work/support/postrm;")
-    
-  # Define dependencies for gcc and the like
-  set(CPACK_DEBIAN_PACKAGE_DEPENDS "build-essential, libopenmpi-dev")
-  set(CPACK_RPM_PACKAGE_REQUIRES "gcc, openmpi-devel")
-
-  # Specify license for FreeBSD pkg
-  set(CPACK_FREEBSD_PACKAGE_LICENSE "GPLv3")
-
-  # Generate postinst and postrm scripts
-  configure_file(
-    cmake/support/install-scripts/postinst.in
-    work/support/${FLAVOR}-postinst
-    @ONLY)
-  configure_file(
-    cmake/support/install-scripts/postrm.in
-    work/support/${FLAVOR}-postrm
-    @ONLY)
-  configure_file(
-    cmake/support/install-scripts/postinst.in
-    work/support/postinst
-    @ONLY)
-  configure_file(
-    cmake/support/install-scripts/postrm.in
-    work/support/postrm
-    @ONLY)
-
-  # Generate the console-errormessage wrapper
-  configure_file(
-    cmake/support/run-scripts/mccode_errmsg.in
-    "work/support/${FLAVOR}_errmsg"
-    @ONLY)
-
-  # Set architecture
-  if(ARCH EQUAL "amd64")
-    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-    set(CPACK_RPM_PACKAGE_ARCHITECTURE    "x86_64")
-  elseif(ARCH EQUAL "i386")
-    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
-    set(CPACK_RPM_PACKAGE_ARCHITECTURE    "i686")
-  else()
-    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${ARCH}")
-    set(CPACK_RPM_PACKAGE_ARCHITECTURE    "${ARCH}")
   endif()
 
-  endif()
+  include(debian)
 endmacro()
 
 # Helper function which can look for input files. Apparently "file(GLOB ...)" is
