Commit 939ef4ad authored by Dick Hollenbeck's avatar Dick Hollenbeck

Add support for building *.deb file using CPack, install ~/fp-lib-table either...

Add support for building *.deb file using CPack, install ~/fp-lib-table either from kicad-install.sh or from make install_user_configuration_files
parent 4e4f4228
...@@ -65,6 +65,13 @@ endif() ...@@ -65,6 +65,13 @@ endif()
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake 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." ) 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. # Set flags for GCC.
...@@ -415,7 +422,7 @@ endif() ...@@ -415,7 +422,7 @@ endif()
#================================================ #================================================
# make uninstall rules # "make uninstall" rules
#================================================ #================================================
configure_file( configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
...@@ -427,8 +434,14 @@ add_custom_target( uninstall ...@@ -427,8 +434,14 @@ add_custom_target( uninstall
#================================================ #================================================
# 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 install( FILES INSTALL.txt
DESTINATION ${KICAD_DOCS} DESTINATION ${KICAD_DOCS}
COMPONENT resources ) COMPONENT resources )
...@@ -444,13 +457,14 @@ if( UNIX ) ...@@ -444,13 +457,14 @@ if( UNIX )
install( DIRECTORY scripts install( DIRECTORY scripts
DESTINATION ${KICAD_DOCS} DESTINATION ${KICAD_DOCS}
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE ) )
endif() endif()
### ###
# FreeDesktop .desktop and MIME resources # FreeDesktop .desktop and MIME resources
### ###
if( UNIX ) if( UNIX )
# Set paths # Set paths
set( UNIX_MIME_DIR resources/linux/mime ) set( UNIX_MIME_DIR resources/linux/mime )
set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk ) set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
...@@ -462,25 +476,46 @@ if( UNIX ) ...@@ -462,25 +476,46 @@ if( UNIX )
install( DIRECTORY ${UNIX_MIMELNK_FILES} install( DIRECTORY ${UNIX_MIMELNK_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE ) )
# Install Mime directory # Install Mime directory
install( DIRECTORY ${UNIX_ICONS_FILES} install( DIRECTORY ${UNIX_ICONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE ) )
# Install Icons # Install Icons
install( DIRECTORY ${UNIX_MIME_FILES} install( DIRECTORY ${UNIX_MIME_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE ) )
# Install Applications directory (.desktop files) # Install Applications directory (.desktop files)
install( DIRECTORY ${UNIX_APPLICATIONS_FILES} install( DIRECTORY ${UNIX_APPLICATIONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE ) )
endif() 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()
...@@ -55,3 +55,17 @@ function( make_lexer inputFile outHeaderFile outCppFile enum ) ...@@ -55,3 +55,17 @@ function( make_lexer inputFile outHeaderFile outCppFile enum )
endfunction() 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 )
...@@ -8,13 +8,13 @@ string( REGEX REPLACE "\n" ";" files "${files}" ) ...@@ -8,13 +8,13 @@ string( REGEX REPLACE "\n" ";" files "${files}" )
foreach( file ${files} ) foreach( file ${files} )
message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" ) message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" )
if( EXISTS "$ENV{DESTDIR}${file}" ) if( EXISTS "$ENV{DESTDIR}${file}" )
EXEC_PROGRAM( exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval RETURN_VALUE rm_retval
) )
if( NOT "${rm_retval}" STREQUAL 0 ) if( NOT "${rm_retval}" STREQUAL "0" )
message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" ) message( STATUS "Problem when removing \"$ENV{DESTDIR}${file}\"" )
endif() endif()
else() else()
message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." ) message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
......
...@@ -95,10 +95,16 @@ install_or_update() ...@@ -95,10 +95,16 @@ install_or_update()
echo "step 7) installing KiCad program files..." echo "step 7) installing KiCad program files..."
sudo make install 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 cd ../../kicad-lib.bzr
rm -rf build && mkdir build && cd build rm -rf build && mkdir build && cd build
cmake ../ cmake ../
...@@ -106,7 +112,7 @@ install_or_update() ...@@ -106,7 +112,7 @@ install_or_update()
echo " kicad-lib installed." echo " kicad-lib installed."
echo "step 9) installing documentation..." echo "step 10) installing documentation..."
cd ../../kicad-doc.bzr cd ../../kicad-doc.bzr
rm -rf build && mkdir build && cd build rm -rf build && mkdir build && cd build
cmake ../ cmake ../
......
install(FILES kicad.pro fp_global_table install( FILES kicad.pro fp-lib-table
DESTINATION ${KICAD_TEMPLATE} DESTINATION ${KICAD_TEMPLATE}
COMPONENT resources) COMPONENT resources
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment