Create a stripped volk_gnsssdr_profile binary for debian packaging

This commit is contained in:
Carles Fernandez 2014-11-14 01:40:43 +01:00
parent 8a13dc489c
commit 3c8e048612
4 changed files with 61 additions and 32 deletions

View File

@ -42,10 +42,12 @@ option(ENABLE_OPENCL "Enable building of processing blocks implemented with Open
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
option(ENABLE_PACKAGING "Enable software packaging" OFF)
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
if(${ENABLE_PACKAGING})
if(ENABLE_PACKAGING)
set(ENABLE_GENERIC_ARCH ON)
endif(${ENABLE_PACKAGING})
set(ENABLE_OWN_GLOG ON)
endif(ENABLE_PACKAGING)
###############################
@ -359,13 +361,17 @@ endif()
# volk_gnsssdr module - GNSS-SDR's own VOLK library
################################################################################
find_package(VolkGnssSdr)
if(ENABLE_PACKAGING)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
set(STRIP_VOLK_GNSSSDR_PROFILE "-DENABLE_STRIP=ON")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
endif(ENABLE_PACKAGING)
if(NOT VOLK_GNSSSDR_FOUND)
ExternalProject_Add(volk_gnsssdr_module
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build -DENABLE_STATIC_LIBS=ON
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build -DENABLE_STATIC_LIBS=ON ${STRIP_VOLK_GNSSSDR_PROFILE}
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
@ -458,7 +464,9 @@ endif(NOT GFlags_FOUND)
################################################################################
# glog - http://code.google.com/p/google-glog/
################################################################################
find_package(GLOG)
if(NOT ${ENABLE_OWN_GLOG})
find_package(GLOG)
endif(NOT ${ENABLE_OWN_GLOG})
set(glog_RELEASE 0.3.3)
if (NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
message (STATUS " glog library has not been found")
@ -1037,8 +1045,8 @@ add_custom_target(uninstall
########################################################################
add_subdirectory(src)
if(${ENABLE_PACKAGING})
if(ENABLE_PACKAGING)
include(GnssSdrPackaging)
endif(${ENABLE_PACKAGING})
endif(ENABLE_PACKAGING)

View File

@ -81,7 +81,7 @@ set(CPACK_STRIP_FILES "${CMAKE_INSTALL_PREFIX}/bin/gnss-sdr;${CM
# Debian-specific settings
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.45), libstdc++6 (>= 4.7), libc6 (>= 2.18), gnuradio (>= 3.7), libarmadillo-dev (>= 1:4.200.0), liblapack-dev (>= 3.5), libopenblas-dev (>= 0.2), gfortran (>= 1:4.7), libssl-dev (>= 1.0), libgflags-dev (>= 2.0)")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.45), libstdc++6 (>= 4.7), libc6 (>= 2.13), gnuradio (>= 3.7), libarmadillo-dev (>= 1:4.200.0), liblapack-dev (>= 3.4), libopenblas-dev (>= 0.1.1), gfortran (>= 1:4.7), libssl-dev (>= 1.0), libgflags-dev (>= 2.0)")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/postinst;${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/prerm")
@ -232,23 +232,23 @@ list(LENGTH CMAKE_TARGET_ARCHITECTURES cmake_target_arch_len)
if(NOT "${cmake_target_arch_len}" STREQUAL "1")
set(CMAKE_TARGET_ARCHITECTURE_UNIVERSAL TRUE)
set(CMAKE_TARGET_ARCHITECTURE_CODE "universal")
else()
else(NOT "${cmake_target_arch_len}" STREQUAL "1")
set(CMAKE_TARGET_ARCHITECTURE_UNIVERSAL FALSE)
set(CMAKE_TARGET_ARCHITECTURE_CODE "${CMAKE_TARGET_ARCHITECTURES}")
endif()
endif(NOT "${cmake_target_arch_len}" STREQUAL "1")
endif(APPLE)
# source package settings
#set (CPACK_SOURCE_TOPLEVEL_TAG "source")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\data/;/\\\\install/;/\\\\thirdparty/;/\\\\docs/html/;/\\\\docs/latex;\\\\.pdf;\\\\.gitignore;\\\\.project$;\\\\.DS_Store;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;\\\\.gitignore;/\\\\data/*;/\\\\install/*;/\\\\thirdparty/;/\\\\docs/html/;/\\\\docs/latex;\\\\.pdf;\\\\.project$;\\\\.DS_Store;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/")
# default binary package settings
set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE)
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}")
if (CPACK_PACKAGE_ARCHITECTURE)
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_ARCHITECTURE}")
endif ()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}")
if(CPACK_PACKAGE_ARCHITECTURE)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_ARCHITECTURE}")
endif(CPACK_PACKAGE_ARCHITECTURE)
if(CPACK_GENERATOR STREQUAL "DEB")
configure_file("${CMAKE_SOURCE_DIR}/cmake/Packaging/fixup_deb_permissions.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/fixup_deb_permissions.sh" @ONLY IMMEDIATE)
@ -260,21 +260,33 @@ if(CPACK_GENERATOR STREQUAL "DEB")
# Write license
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/copyright"
"Copyright (C) 2010-2014 ${CPACK_PACKAGE_CONTACT}
This software may be licensed under the terms of the
GNU General Public License Version 3 (the ``GPL''),
or (at your option) any later version.
Software distributed under the License is distributed
on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
express or implied. See the LGPL for the specific language
governing rights and limitations.
You should have received a copy of the GPL along with this
program. If not, go to http://www.gnu.org/licenses/gpl.html
or write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
On Debian systems, the complete text of the GNU General
Public License can be found in
`/usr/share/common-licenses/GPL-3'.")
"Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: gnss-sdr
Source: git://github.com/gnss-sdr/gnss-sdr
Files: *
Copyright: Copyright 2014 ${CPACK_PACKAGE_CONTACT}
License: GPL-3+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later
version.
.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.
.
You should have received a copy of the GNU General Public
License along with this package; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301 USA
.
On Debian systems, the full text of the GNU General Public
License version 3 can be found in the file
`/usr/share/common-licenses/GPL-3'.")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/copyright"
DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")

View File

@ -32,6 +32,8 @@ enable_testing()
set(VERSION 0.1)
set(LIBVER 0.0.0)
option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF)
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #allows this to be a sub-project
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) #allows this to be a sub-project
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) #location for custom "Modules"

View File

@ -51,6 +51,13 @@ add_executable(volk_gnsssdr_profile
target_link_libraries(volk_gnsssdr_profile volk_gnsssdr ${Boost_LIBRARIES} ${Clang_required_link})
if(ENABLE_STRIP)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile
PROPERTIES LINK_FLAGS "-s")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
endif(ENABLE_STRIP)
install(
TARGETS volk_gnsssdr_profile
DESTINATION bin