Skip to content

Commit c6d64a4

Browse files
committed
Added package generation
1 parent 68b2386 commit c6d64a4

File tree

7 files changed

+87
-6
lines changed

7 files changed

+87
-6
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ IF (FULLTYPES)
2828
ENDIF ()
2929

3030
# Check whether sac2c is operational
31-
INCLUDE ("cmake-common/check-sac2c.cmake")
31+
INCLUDE ("cmake-common/check-sac2c.cmake") # get SAC2C_VERSION
3232
INCLUDE ("cmake-common/misc-macros.cmake")
33+
INCLUDE ("cmake-common/generate-version-vars.cmake")
3334

3435
INCLUDE ("cmake/config.cmake")
3536

@@ -43,3 +44,11 @@ ENDFOREACH ()
4344

4445
# This build target is responsible for generating the package sac2crc file
4546
CREATE_SAC2CRC_TARGET ("stdlib" "${DLL_BUILD_DIR}" "${DLL_BUILD_DIR}")
47+
48+
# lets create packages
49+
SET (PROJECT_SHORT_VERSION)
50+
SET (PROJECT_MAJOR_VERSION)
51+
SET (PROJECT_MINOR_VERSION)
52+
SET (PROJECT_PATCH_VERSION)
53+
GET_PROJECT_VERSION (PROJECT_SHORT_VERSION PROJECT_MAJOR_VERSION PROJECT_MINOR_VERSION PROJECT_PATCH_VERSION)
54+
INCLUDE ("${PROJECT_SOURCE_DIR}/cmake/cpack.cmake")

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Currently not set - all rights reserved!

cmake/cpack.cmake

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This file activates CPack binary packaging for different distributions
2+
# At the moment we support only *UNIX systems (DEB, RPM, productbuild (MacOS),
3+
# and TGZ).
4+
5+
IF (NOT DEFINED SAC2C_VERSION)
6+
MESSAGE (FATAL_ERROR "Sac2c Version not set!")
7+
ENDIF ()
8+
9+
IF (NOT DEFINED PROJECT_SHORT_VERSION)
10+
MESSAGE (FATAL_ERROR "WHDH:LSDFH")
11+
ENDIF ()
12+
13+
# By setting this on we can see where installation targets are specified via
14+
# absolute paths. XXX (???) For portability purposes this should be avoided.
15+
SET (CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON)
16+
17+
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
18+
SET (CPACK_GENERATOR "productbuild;TGZ")
19+
ELSE ()
20+
SET (CPACK_GENERATOR "RPM;DEB;TGZ")
21+
ENDIF ()
22+
23+
# We create separate config files for different generators
24+
#set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/cmake/cpack_options.cmake")
25+
26+
# Set default CPack Packaging options
27+
SET (CPACK_PACKAGE_NAME "sac-stdlib")
28+
SET (CPACK_PACKAGE_VENDOR "SaC Development Team")
29+
SET (CPACK_PACKAGE_CONTACT "[email protected]")
30+
SET (CPACK_PACKAGE_VERSION "${PROJECT_SHORT_VERSION}")
31+
SET (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_MAJOR_VERSION}")
32+
SET (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_MINOR_VERSION}")
33+
SET (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_PATCH_VERSION}")
34+
#SET (CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/sac_logo.png")
35+
SET (CPACK_MONOLITHIC_INSTALL TRUE)
36+
SET (CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
37+
38+
# SET (CPACK_PACKAGE_DESCRIPTION_FILE ...)
39+
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "The standard library for a data-parallel array-based functional language SAC")
40+
# FIXME(artem) We need to decide on where do we put the stuff on the target system...)
41+
#SET (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
42+
SET (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
43+
SET (CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/cmake/cpack/README.txt")
44+
SET (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/cmake/cpack/WELCOME.txt")
45+
46+
# Debian-specific variables
47+
SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
48+
SET (CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
49+
SET (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) # non-functional?
50+
# FIXME Can we auto-generate these dependencies?
51+
SET (CPACK_DEBIAN_PACKAGE_DEPENDS "sac2c-compiler (= ${SAC2C_VERSION})")
52+
53+
# RPM-specific variables
54+
# XXX (hans): this may not be exhaustive - does not take into account if the user
55+
# changes the install prefix
56+
SET (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/local /usr/local/bin /usr/local/include /usr/local/lib /usr/local/libexec /usr/local/share)
57+
# FIXME Can we auto-generate these dependencies?
58+
STRING (REPLACE "-" "_" _sac2c_rpm_version ${SAC2C_VERSION})
59+
SET (CPACK_RPM_PACKAGE_REQUIRES "sac2c-compiler = ${_sac2c_rpm_version}") # we don't need to go crazy here as rpmbuild handles most of this for us
60+
61+
INCLUDE (CPack)
62+
63+
# vim: ts=2 sw=2 et:

cmake/cpack/README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This package provides the standard library for the SAC array
2+
programming language. To use it, please install the SAC compile
3+
as well, called `sac2c'.

cmake/cpack/WELCOME.txt

Whitespace-only changes.

src/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ INCLUDE ("${CMAKE_SOURCE_DIR}/cmake-common/sac2c-variables.cmake")
33
INCLUDE ("${CMAKE_SOURCE_DIR}/cmake-common/generate-sac2c-dependency-targets.cmake")
44
INCLUDE ("${CMAKE_SOURCE_DIR}/cmake/parse-core-ext-files.cmake")
55

6+
# To ensure we that we are able to generate packages, we need to removed the
7+
# leading `/' on the install paths.
8+
STRING (REPLACE "/usr/local/" "" _install_mod_dir ${INSTALL_MOD_DIR})
9+
STRING (REPLACE "/usr/local/" "" _install_tree_dir ${INSTALL_TREE_DIR})
10+
611
# This variable will hold all the Mod/Tree files that this module
712
# will deliver and they will become a part of the all-modules target
813
# which will be the only default target generated by this makefile.
@@ -360,11 +365,11 @@ FOREACH (name ${SAC_SRC})
360365
# to the corresponding locations.
361366
INSTALL (
362367
FILES "${mod}"
363-
DESTINATION ${INSTALL_MOD_DIR}/${TARGET_ENV}/${SBI})
368+
DESTINATION ${_install_mod_dir}/${TARGET_ENV}/${SBI})
364369
IF (NOT SAC_NOTREE)
365370
INSTALL (
366371
FILES "${tree}"
367-
DESTINATION ${INSTALL_TREE_DIR}/tree/${TARGET_ENV})
372+
DESTINATION ${_install_tree_dir}/tree/${TARGET_ENV})
368373
ENDIF ()
369374
ENDFOREACH (name)
370375

@@ -417,10 +422,10 @@ FOREACH (name ${XSAC_SRC})
417422
# to the corresponding locations.
418423
INSTALL (
419424
FILES "${mod}"
420-
DESTINATION ${INSTALL_MOD_DIR}/${TARGET_ENV}/${SBI})
425+
DESTINATION ${_install_mod_dir}/${TARGET_ENV}/${SBI})
421426
IF (NOT SAC_NOTREE)
422427
INSTALL (
423428
FILES "${tree}"
424-
DESTINATION ${INSTALL_TREE_DIR}/tree/${TARGET_ENV})
429+
DESTINATION ${_install_tree_dir}/tree/${TARGET_ENV})
425430
ENDIF ()
426431
ENDFOREACH (name)

0 commit comments

Comments
 (0)