Fix packaging of license file
CPACK doesn't have proper logic for installing the license as described
by CPACK_RESOURCE_FILE_LICENSE.
For Debian packaging, the license is expected to be installed as:
/usr/share/doc/PACKAGENAME/copyright
To do this, I've added a bit of logic for CPACK to copy this into the
package using CPACK_INSTALL_COMMANDS to prep the directory, and
CPACK_INSTALLED_DIRECTORIES to add it to the package. This applies to
both RPM and DEB, so I've added some logic to the spec file to exclude
this file (note that CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION does
not work for files installed with CPACK_INSTALLED_DIRECTORIES).
For RPM install, I've just added a small bit of logic to the spec file
to handle it. The file needs to be copied into the spec working
directory, then a macro is used to handle the rest. Note the license
macro does not work on EL6, but I don't think we want to support this.
Change-Id: I06ce63d300419893cb8274bc504a15633e304d91
Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
[ROCm/ROCR-Runtime commit: 7649cd862e]
This commit is contained in:
@@ -211,7 +211,7 @@ install ( TARGETS ${HSAKMT_TARGET} EXPORT ${HSAKMT_TARGET}Targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel )
|
||||
|
||||
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT devel )
|
||||
#install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT devel )
|
||||
|
||||
# Install public headers
|
||||
install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
@@ -303,6 +303,11 @@ if (DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
|
||||
else()
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE "local")
|
||||
endif()
|
||||
# Logic to install debian copyright file (i.e. the license file)
|
||||
set(CPACK_INSTALL_COMMANDS "install -m 644 -D ${CPACK_RESOURCE_FILE_LICENSE} \
|
||||
${PROJECT_BINARY_DIR}/doc/${CPACK_DEBIAN_PACKAGE_NAME}/copyright")
|
||||
set(CPACK_INSTALLED_DIRECTORIES "${PROJECT_BINARY_DIR}/doc/${CPACK_DEBIAN_PACKAGE_NAME}"
|
||||
"/usr/share/doc/${CPACK_DEBIAN_PACKAGE_NAME}")
|
||||
## Process the Debian install/remove scripts to update the CPACK variables
|
||||
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY )
|
||||
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/prerm.in DEBIAN/prerm @ONLY )
|
||||
|
||||
@@ -55,6 +55,9 @@ Recommends: @CPACK_RPM_PACKAGE_RECOMMENDS@
|
||||
%prep
|
||||
mv $RPM_BUILD_ROOT %_topdir/tmpBBroot
|
||||
|
||||
# The license macro expects the license to be copied into the working directory
|
||||
cp -a @CPACK_RESOURCE_FILE_LICENSE@ ./LICENSE.md
|
||||
|
||||
%install
|
||||
if [ -e $RPM_BUILD_ROOT ];
|
||||
then
|
||||
@@ -91,6 +94,10 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
|
||||
@CPACK_RPM_ABSOLUTE_INSTALL_FILES@
|
||||
@CPACK_RPM_USER_INSTALL_FILES@
|
||||
|
||||
# RPM has a different way of packaging the license, ignore the debian one:
|
||||
%license LICENSE.md
|
||||
%exclude /usr/share/doc/@CPACK_DEBIAN_PACKAGE_NAME@
|
||||
|
||||
%changelog
|
||||
@CPACK_RPM_SPEC_CHANGELOG@
|
||||
|
||||
|
||||
Reference in New Issue
Block a user