Add support for building *.deb file using CPack, install ~/fp-lib-table either from kicad-install.sh or from make install_user_configuration_files

This commit is contained in:
Dick Hollenbeck 2013-10-17 14:03:36 -05:00
parent 4e4f422814
commit 939ef4ad59
7 changed files with 79 additions and 23 deletions

View File

@ -65,6 +65,13 @@ endif()
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
if( UNIX )
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specifig KiCad config files" )
elseif( MINGW )
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specifig KiCad config files" )
endif()
mark_as_advanced( KICAD_USER_CONFIG_DIR )
#================================================
# Set flags for GCC.
@ -415,20 +422,26 @@ endif()
#================================================
# make uninstall rules
# "make uninstall" rules
#================================================
configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY )
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY )
add_custom_target( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
#================================================
# Installation parameters
# Installation
#================================================
add_custom_target( install_user_configuration_files
"${CMAKE_COMMAND}" -E copy "${PROJECT_SOURCE_DIR}/template/fp-lib-table" ${KICAD_USER_CONFIG_DIR}/
COMMENT "Install template fp-lib-table into your home directory."
)
install( FILES INSTALL.txt
DESTINATION ${KICAD_DOCS}
COMPONENT resources )
@ -442,15 +455,16 @@ install( FILES resources/freeroute.jnlp
###
if( UNIX )
install( DIRECTORY scripts
DESTINATION ${KICAD_DOCS}
COMPONENT resources
PATTERN ".svn" EXCLUDE )
DESTINATION ${KICAD_DOCS}
COMPONENT resources
)
endif()
###
# FreeDesktop .desktop and MIME resources
###
if( UNIX )
# Set paths
set( UNIX_MIME_DIR resources/linux/mime )
set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
@ -462,25 +476,46 @@ if( UNIX )
install( DIRECTORY ${UNIX_MIMELNK_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources
PATTERN ".svn" EXCLUDE )
)
# Install Mime directory
install( DIRECTORY ${UNIX_ICONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources
PATTERN ".svn" EXCLUDE )
)
# Install Icons
install( DIRECTORY ${UNIX_MIME_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources
PATTERN ".svn" EXCLUDE )
)
# Install Applications directory (.desktop files)
install( DIRECTORY ${UNIX_APPLICATIONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources
PATTERN ".svn" EXCLUDE )
)
endif()
include( CTest )
#include( CTest )
if( UNIX AND NOT APPLE )
# Create a *.deb file:
set( CPACK_GENERATOR "DEB" )
set( CPACK_DEBIAN_PACKAGE_MAINTAINER "http://launchpad.net/kicad" )
set( CPACK_PACKAGE_VERSION_MAJOR 1 )
set( CPACK_PACKAGE_VERSION_MINOR 0 )
set( CPACK_PACKAGE_VERSION_PATCH 0 )
#set( CPACK_PACKAGE_CONTACT Firstname Lastname <email@company.com> )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "KiCad built by CMake build system." )
# Tell debian CPack about all files which are configuration files
add_conffiles() # clear file
add_conffiles( ${KICAD_USER_CONFIG_DIR}/fp-lib-table ) # append to it
include( CPack )
endif()

View File

@ -55,3 +55,17 @@ function( make_lexer inputFile outHeaderFile outCppFile enum )
endfunction()
# Is a macro instead of function so there's a higher probability that the
# scope of CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA is global
macro( add_conffiles )
if( ${ARGC} STREQUAL "0" )
# remove the file when user passes no arguments, which he should do exactly once at top
file( REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
else()
foreach( filename ${ARGV} )
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/conffiles "${filename}\n" )
endforeach()
set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
endif()
endmacro( add_conffiles )

View File

@ -8,13 +8,13 @@ string( REGEX REPLACE "\n" ";" files "${files}" )
foreach( file ${files} )
message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" )
if( EXISTS "$ENV{DESTDIR}${file}" )
EXEC_PROGRAM(
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if( NOT "${rm_retval}" STREQUAL 0 )
message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" )
if( NOT "${rm_retval}" STREQUAL "0" )
message( STATUS "Problem when removing \"$ENV{DESTDIR}${file}\"" )
endif()
else()
message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )

View File

@ -95,10 +95,16 @@ install_or_update()
echo "step 7) installing KiCad program files..."
sudo make install
echo " kicad installed."
echo " kicad program files installed."
echo "step 8) installing libraries..."
echo "step 8) as non-root, install user configuration files..."
# install ~/fp-lib-table [and friends]
make install_user_configuration_files
echo " kicad user-configuration files installed."
echo "step 9) installing libraries..."
cd ../../kicad-lib.bzr
rm -rf build && mkdir build && cd build
cmake ../
@ -106,7 +112,7 @@ install_or_update()
echo " kicad-lib installed."
echo "step 9) installing documentation..."
echo "step 10) installing documentation..."
cd ../../kicad-doc.bzr
rm -rf build && mkdir build && cd build
cmake ../

View File

@ -1,3 +1,4 @@
install(FILES kicad.pro fp_global_table
DESTINATION ${KICAD_TEMPLATE}
COMPONENT resources)
install( FILES kicad.pro fp-lib-table
DESTINATION ${KICAD_TEMPLATE}
COMPONENT resources
)

View File

Can't render this file because it has a wrong number of fields in line 3.