Georg Sauthoff 2016-08-24 08:42:36 +02:00
parent d648e92188
commit 064e38eae9
3 changed files with 67 additions and 1 deletions

View file

@ -43,13 +43,38 @@ target_link_libraries(${PROJECT_NAME}
mksh vroot pthread
)
# default install prefix is /usr/local
# change it with e.g. -DCMAKE_INSTALL_PREFIX=/usr
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(FILES man/man1/make.1 DESTINATION share/man/man1)
install(FILES bin/make.rules.file DESTINATION share/${PROJECT_NAME}
RENAME make.rules)
install(FILES bin/svr4.make.rules.file DESTINATION share/${PROJECT_NAME}
RENAME svr4.make.rules)
install(FILES README.md DESTINATION share/doc/${PROJECT_NAME}
install(FILES COPYING
README.md
DESTINATION share/doc/${PROJECT_NAME}
)
install(DIRECTORY example DESTINATION share/doc/${PROJECT_NAME}
)
# select the package generator with e.g. -DCPACK_GENERATOR='RPM;DEB'
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "illumos dmake, Sun make compatible")
set(CPACK_PACKAGE_CONTACT "mail@georg.so")
set(CPACK_PACKAGE_VENDOR "misc")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README_pkg.txt")
set(CPACK_RPM_PACKAGE_LICENSE "CDDL")
# used by some generators like NSI, is only displayed in the installer
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
# only used by some generators
set(CPACK_PACKAGE_INSTALL_DIRECTORY
"${PROJECT_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "6")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_RPM_PACKAGE_GROUP "Development/Tools")
set(CPACK_RPM_PACKAGE_URL "https://github.com/gsauthof/somake")
# CPackDeb default to CPACK_PACKAGE_DESCRIPTION_SUMMARY, although
# the long description makes more sense ...
file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_DEBIAN_PACKAGE_DESCRIPTION)
include(CPack)

View file

@ -342,6 +342,32 @@ the following order:
5. `/usr/share/lib/make/make.rules`
6. `/etc/default/make.rules`
## Packaging
The CMake build file `CMakeLists.txt` also defines some variables
for CPack, the CMake companion tool for creating binary packages.
For example, to create `.rpm` and `.deb` packages:
$ cmake ../somake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DCPACK_GENERATOR='RPM;DEB' -GNinja
$ ninja-build package
$ ls somake-*
somake-0.6.0-Linux.deb somake-0.6.0-Linux.rpm
As always, the `-GNinja` generator option can be dropped -
`ninja-build` has to be replaced with `make` then.
The content of the archives can be verified like this:
$ dpkg --contents somake-0.6.0-Linux.deb
$ dpkg --info somake-0.6.0-Linux.deb
Or:
$ rpm2cpio somake-0.6.0-Linux.rpm | cpio --list -v
$ rpm -qip somake-0.6.0-Linux.rpm
## License

15
README_pkg.txt Normal file
View file

@ -0,0 +1,15 @@
`somake` is a portable version of illumos make. illumos make is
derived from Sun's dmake (distributed make) which in turn is
compatible with the bonus features of Sun make. Notable Sun make
features are:
- command dependencies (target is considered outdated if used
variable has changed)
- hidden dependencies (automatic dependency generation for
included headers)
- target groups
- conditional macro assignment (different syntax than with GNU
make)
- include file generation (similar to GNU make)
See also: https://github.com/gsauthof/somake