Commit 75a04d56 authored by Kip Warner's avatar Kip Warner

Initial Debianization (#228)

parent f5b780fa
cmake_minimum_required (VERSION 3.1.3) cmake_minimum_required (VERSION 3.1.3)
project (pistache) project (pistache)
include(GNUInstallDirs)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-missing-field-initializers") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-missing-field-initializers")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
...@@ -76,11 +78,13 @@ if (PISTACHE_SSL) ...@@ -76,11 +78,13 @@ if (PISTACHE_SSL)
endif (PISTACHE_SSL) endif (PISTACHE_SSL)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
# Set version... # Set version...
# Major and minor version... # Major and minor version...
set(VERSION_MAJOR 0) set(VERSION_MAJOR 0)
set(VERSION_MINOR 0) set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
# Make available in a header file... # Make available in a header file...
configure_file ( configure_file (
...@@ -89,6 +93,16 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) ...@@ -89,6 +93,16 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
@ONLY @ONLY
) )
# Install version header...
if(PISTACHE_INSTALL)
install (
FILES
${CMAKE_BINARY_DIR}/include/pistache/version.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/pistache/
)
endif()
# Set libraries... # Set libraries...
# Minimum... # Minimum...
...@@ -99,25 +113,15 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) ...@@ -99,25 +113,15 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
set(LIBS "${LIBS} -lssl -lcrypto") set(LIBS "${LIBS} -lssl -lcrypto")
endif(PISTACHE_SSL) endif(PISTACHE_SSL)
if(PISTACHE_INSTALL)
# Install header...
install (
FILES
${CMAKE_BINARY_DIR}/include/pistache/version.h
DESTINATION
include/pistache/
)
endif()
# Configure the pkg-config metadata... # Configure the pkg-config metadata...
# Initialize the metadata variables and to support remote builds... # Initialize the metadata variables and to support remote builds...
set(prefix ${CMAKE_INSTALL_PREFIX}) set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}/)
set(libs ${LIBS}) set(libs ${LIBS})
set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}/)
set(version ${VERSION_MAJOR}.${VERSION_MINOR}) set(version ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
# Perform substitutions... # Perform substitutions...
configure_file ( configure_file (
...@@ -126,15 +130,15 @@ endif() ...@@ -126,15 +130,15 @@ endif()
@ONLY @ONLY
) )
if(PISTACHE_INSTALL)
# Install pkg-config metadata into standard location within the prefix... # Install pkg-config metadata into standard location within the prefix...
install ( if(PISTACHE_INSTALL)
FILES install (
${CMAKE_BINARY_DIR}/libpistache.pc FILES
DESTINATION ${CMAKE_BINARY_DIR}/libpistache.pc
lib/pkgconfig/ DESTINATION
) ${CMAKE_INSTALL_LIBDIR}/pkgconfig/
endif() )
endif()
add_subdirectory (src) add_subdirectory (src)
...@@ -180,4 +184,28 @@ if (PISTACHE_BUILD_DOCS) ...@@ -180,4 +184,28 @@ if (PISTACHE_BUILD_DOCS)
message(FATAL_ERROR "Doxygen need to be installed to generate the doxygen documentation") message(FATAL_ERROR "Doxygen need to be installed to generate the doxygen documentation")
endif(DOXYGEN_FOUND) endif(DOXYGEN_FOUND)
endif() endif()
\ No newline at end of file
# Generate source tarball...
# Define version of source archive...
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
# Generate a .tar.bz2
set(CPACK_SOURCE_GENERATOR "TBZ2")
# Set filename...
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Don't include these files in the archive...
set(CPACK_SOURCE_IGNORE_FILES
"/build/;/debian/;/prefix/;/.git*;~$;${CPACK_SOURCE_IGNORE_FILES}")
# Include the CPack module for generating the archive and add the standard
# dist target to the generated makefile...
include(CPack)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
pistache (0.0.0-kip1~cosmic) cosmic; urgency=medium
* Initial release.
-- Kip Warner <kip@thevertigo.com> Tue, 2 Apr 2019 19:25:11 -0700
Source: pistache
Section: libdevel
Priority: optional
Maintainer: Dennis Jenkins <dennis.jenkins.75@gmail.com>
Standards-Version: 4.2.1
Build-Depends:
cmake (>= 3.8.0),
debhelper (>= 11),
dh-exec,
libc6-dev (>= 2.26),
libcurl4-openssl-dev,
libgtest-dev (>= 1.8.0),
libssl-dev (>= 1.1.1),
libstdc++6 (>= 7.2.0),
lintian,
pkg-config (>= 0.28),
rapidjson-dev (>= 1.1.0),
valgrind
Vcs-Git: https://github.com/oktal/pistache.git
Vcs-browser: https://www.github.com/oktal/pistache
Homepage: https://www.github.com/oktal/pistache
Package: libpistache-dev
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
Depends:
${misc:Depends},
pkg-config (>= 0.28),
libpistache0 (= ${binary:Version})
Description: elegant C++ REST framework
Pistache is a C++ REST framework originally written by Mathieu Stefani at
Datacratic, since maintained by other volunteers. It is written in pure C++11
with no external dependency and provides a low-level HTTP abstraction.
.
Pistache provides both an HTTP client and server that can be used to create and
query complex web and REST APIs.
.
It is free as in freedom and released under the Apache 2.0 license.
.
This package contains the development headers, static library, and examples.
Package: libpistache0
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
Depends:
${misc:Depends},
${shlibs:Depends}
Description: elegant C++ REST framework
Pistache is a C++ REST framework originally written by Mathieu Stefani at
Datacratic, since maintained by other volunteers. It is written in pure C++11
with no external dependency and provides a low-level HTTP abstraction.
.
Pistache provides both an HTTP client and server that can be used to create and
query complex web and REST APIs.
.
It is free as in freedom and released under the Apache 2.0 license.
.
This package contains the shared library.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pistache
Upstream-Contact: Dennis Jenkins <dennis.jenkins.75@gmail.com>
Source: https://github.com/oktal/pistache.git
Comment: Upstream's Debianization.
Files: *
Copyright: Mathieu Stefani <mathieu@datacratic.com>
License: Apache-2.0
A permissive license whose main conditions require preservation of copyright
and license notices. Contributors provide an express grant of patent rights.
Licensed works, modifications, and larger works may be distributed under
different terms and without source code.
Files: debian/pbuilder-hooks/C10shell
Copyright: Copyright 2001-2007 Junichi Uekawa
License: GPL-2+
/usr/share/common-licenses/GPL-2
usr/lib/*/pkgconfig
usr/lib/*/cmake
usr/include usr
usr/lib/*/libpistache*.a
usr/lib/*/libpistache*.so
usr/lib/*/libpistache*.so.*
#!/bin/bash
# example file to be used with --hookdir
#
# invoke shell if build fails.
apt install -y "${APTGETOPT[@]}" nano less
cd /tmp/buildd/*/debian/..
/bin/bash < /dev/tty > /dev/tty 2> /dev/tty
#!/usr/bin/make -f
#
# Pistache.
# Copyright (C) 2015-2019 Mathieu Stefani. Released under the terms of the
# Apache License 2.0.
#
# Output every command that modifies files on the build system...
DH_VERBOSE = 1
export DH_OPTIONS=-v
# Set flags for how the package will be compiled and built. Note separated with
# white space and not comma, as per DPM § 4.9.1...
# Set various group related security hardening build flags for format,
# fortify, stackprotector, relro, bindnow, and pie...
DH_BUILD_MAINT_OPTIONS = hardening=+all
# Skip unit testing...
#DH_BUILD_MAINT_OPTIONS += nocheck
# The above should be reflected when dpkg-buildflags is called and merged
# with the defaults...
export DH_BUILD_MAINT_OPTIONS
export DPKG_EXPORT_BUILDFLAGS = 1
# Standard rules and preset shell variables...
include /usr/share/dpkg/default.mk
# Directory containing package since may not be called from current working
# directory. MAKEFILE_LIST pre-defined by Make and appended each time another
# makefile is included, so first one should be debian/rules...
PACKAGE_DIR = $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
# Source directory...
SOURCE_DIR = $(abspath $(PACKAGE_DIR)/../)
# Main packaging script based on debhelper 7 syntax. The % is an implicit
# pattern rule that acts as a universal target...
%:
dh $@
# Configure source...
override_dh_auto_configure:
dh_auto_configure -- \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_BUILD_DOCS=false \
-DPISTACHE_USE_SSL=true \
-DCMAKE_INSTALL_PREFIX=/usr \
$(SOURCE_DIR)
# Perform unit testing, but only if not disabled...
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
@echo "# Performing unit tests..."
dh_auto_test -- test test_memcheck || { find . -iname "LastTest.log" -exec cat {} \; exit 99; }
endif
# Prepare an upstream vanilla distribution tarball as per DPM § 4.9...
# http://wiki.debian.org/onlyjob/get-orig-source
get-orig-source: $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.bz2 $(info I: $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM))
@
# Prepare an upstream vanilla distribution tarball...
$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.bz2:
@echo "# Preparing source for $(DEB_SOURCE) v$(DEB_VERSION_UPSTREAM)..."
cd $(SOURCE_DIR) \
&& cd $(PACKAGE_DIR) \
&& mkdir $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM) \
&& cd $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM) \
&& cmake \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_BUILD_DOCS=false \
-DPISTACHE_USE_SSL=true \
-DCMAKE_INSTALL_PREFIX=/usr \
$(SOURCE_DIR) \
&& make dist \
&& mv -v $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM).tar.bz2 $(SOURCE_DIR)/../$@
@echo "# Cleaning up..."
cd $(PACKAGE_DIR)/$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM) \
&& make clean
cd $(PACKAGE_DIR) \
&& $(RM) -r $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)
# Targets which aren't actual products...
.PHONY: get-orig-source override_dh_auto_configure override_dh_auto_test
...@@ -11,6 +11,7 @@ namespace Version { ...@@ -11,6 +11,7 @@ namespace Version {
static constexpr int Major = @VERSION_MAJOR@; static constexpr int Major = @VERSION_MAJOR@;
static constexpr int Minor = @VERSION_MINOR@; static constexpr int Minor = @VERSION_MINOR@;
static constexpr int Patch = @VERSION_PATCH@;
} // namespace Version } // namespace Version
} // namespace Pistache } // namespace Pistache
...@@ -19,9 +19,9 @@ target_include_directories(pistache PUBLIC ...@@ -19,9 +19,9 @@ target_include_directories(pistache PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
) )
set(include_install_dir "include") set(include_install_dir ${CMAKE_INSTALL_INCLUDEDIR})
set(lib_install_dir "lib/") set(lib_install_dir ${CMAKE_INSTALL_LIBDIR})
set(bin_install_dir "bin/") set(bin_install_dir ${CMAKE_INSTALL_BINDIR})
add_library(pistache_shared SHARED $<TARGET_OBJECTS:pistache>) add_library(pistache_shared SHARED $<TARGET_OBJECTS:pistache>)
add_library(pistache_static STATIC $<TARGET_OBJECTS:pistache>) add_library(pistache_static STATIC $<TARGET_OBJECTS:pistache>)
...@@ -41,7 +41,7 @@ set_target_properties(pistache_static PROPERTIES ...@@ -41,7 +41,7 @@ set_target_properties(pistache_static PROPERTIES
) )
if (PISTACHE_INSTALL) if (PISTACHE_INSTALL)
set(Pistache_CMAKE_INSTALL_PATH "lib/cmake/pistache") set(Pistache_CMAKE_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/pistache")
set(Pistache_CONFIG_FILE "PistacheConfig.cmake") set(Pistache_CONFIG_FILE "PistacheConfig.cmake")
install( install(
...@@ -58,7 +58,7 @@ if (PISTACHE_INSTALL) ...@@ -58,7 +58,7 @@ if (PISTACHE_INSTALL)
FILES_MATCHING PATTERN "*.*h") FILES_MATCHING PATTERN "*.*h")
install(TARGETS pistache_static install(TARGETS pistache_static
EXPORT PistacheTargets EXPORT PistacheTargets
DESTINATION lib) DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT PistacheTargets install(EXPORT PistacheTargets
DESTINATION ${Pistache_CMAKE_INSTALL_PATH} DESTINATION ${Pistache_CMAKE_INSTALL_PATH}
EXPORT_LINK_INTERFACE_LIBRARIES EXPORT_LINK_INTERFACE_LIBRARIES
......
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