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()
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,7 +422,7 @@ endif()
#================================================
# make uninstall rules
# "make uninstall" rules
#================================================
configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
......@@ -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
DESTINATION ${KICAD_DOCS}
COMPONENT resources )
......@@ -444,13 +457,14 @@ if( UNIX )
install( DIRECTORY scripts
DESTINATION ${KICAD_DOCS}
COMPONENT resources
PATTERN ".svn" EXCLUDE )
)
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()
......@@ -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 )
......@@ -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." )
......
......@@ -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 ../
......
install(FILES kicad.pro fp_global_table
install( FILES kicad.pro fp-lib-table
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