Add Arch packaging.
TODO: Gentoo, Debian and Red Hat packaging.
This commit is contained in:
parent
ee0720cd67
commit
f30f1431fd
|
@ -101,3 +101,53 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
$<CONFIGURATION> -R "^${PROJECT_NAME}_test$"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
if (EXISTS "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.PKGBUILD.in")
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.PKGBUILD.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PKGBUILD @ONLY
|
||||
)
|
||||
endif()
|
||||
|
||||
if (EXISTS "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.ebuild.in")
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.ebuild.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.ebuild @ONLY
|
||||
)
|
||||
endif()
|
||||
|
||||
if (BUILD_TARBALL OR BUILD_ARCH)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
COMMENT "Create tarball"
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND scripts/${PROJECT_NAME}_make dist && mv ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.tar.gz* ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
elseif (BUILD_TARBALL_RELEASE OR BUILD_ARCH_RELEASE)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
COMMENT "Create tarball"
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND scripts/${PROJECT_NAME}_make dist_release && mv ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.tar.gz* ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (BUILD_ARCH_RELEASE)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
COMMENT "Build arch package"
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND makepkg -sfr --sign
|
||||
)
|
||||
elseif (BUILD_ARCH)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
COMMENT "Build arch package"
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND makepkg -sfr
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -29,6 +29,11 @@ cmake --build .
|
|||
cmake --install . --prefix /usr
|
||||
```
|
||||
|
||||
This will install the library to /usr/lib and the headers to /usr/include/docpp.
|
||||
If you use Arch Linux, you can install the library by specifying -DBUILD_ARCH=ON to the cmake build command. This requires makepkg. If you don't specify anything, a PKGBUILD will be generated in the build directory.
|
||||
If you use Gentoo Linux, an ebuild will automatically be generated in the build directory.
|
||||
If you use a package manager that uses DEB or RPM packages, you can enable the BUILD_DEB or BUILD_RPM options to generate a package, which will be placed in the build directory.
|
||||
|
||||
## Usage
|
||||
|
||||
Just include docpp.hpp in your project and link against the library. Examples can be found in the examples directory.
|
||||
|
|
31
cmake/docpp.PKGBUILD.in
Normal file
31
cmake/docpp.PKGBUILD.in
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Maintainer: speedie <speedie"@speedie.site>
|
||||
|
||||
pkgname="@PROJECT_NAME@"
|
||||
pkgver="@PROJECT_VERSION@"
|
||||
pkgrel=1
|
||||
pkgdesc="@PROJECT_DESCRIPTION@"
|
||||
url="@PROJECT_HOMEPAGE@"
|
||||
arch=(i686 x86_64)
|
||||
license=(@PROJECT_LICENSE@)
|
||||
depends=()
|
||||
makedepends=(cmake)
|
||||
provides=($pkgname)
|
||||
conflicts=($pkgname)
|
||||
source=(
|
||||
"$pkgname-$pkgver.tar.gz"
|
||||
)
|
||||
|
||||
md5sums=('SKIP')
|
||||
|
||||
build(){
|
||||
cmake -B build -S "$pkgname-$pkgver" \
|
||||
-DCMAKE_BUILD_TYPE='Release' \
|
||||
-DCMAKE_INSTALL_PREFIX='/usr'
|
||||
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
install -Dm644 $pkgbase-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
|
||||
}
|
|
@ -44,82 +44,19 @@ gen_pkg() {
|
|||
esac
|
||||
done
|
||||
|
||||
if [ -x "$(command -v gpg)" ]; then
|
||||
if [ -x "$(command -v gpg)" ] && [ "$1" = "release" ]; then
|
||||
gpg --detach-sign --yes --local-user "${USER}" ${proj}-${version}.tar.gz
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v md5sum)" ]; then
|
||||
if [ -x "$(command -v md5sum)" ] && [ "$1" = "release" ]; then
|
||||
md5sum *.tar.gz | cut -d ' ' -f 1 > ${proj}-${version}.tar.gz.md5
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v sha256sum)" ]; then
|
||||
if [ -x "$(command -v sha256sum)" ] && [ "$1" = "release" ]; then
|
||||
sha256sum *.tar.gz | cut -d ' ' -f 1 > ${proj}-${version}.tar.gz.sha256
|
||||
fi
|
||||
}
|
||||
|
||||
#gen_gentoo_pkg() {
|
||||
#[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
||||
#version="${version:-$(grep project CMakeLists.txt | sed "s/project(${proj} VERSION //g")}"
|
||||
#
|
||||
#USER="$(whoami)"
|
||||
#printf "Is your GPG key '$(whoami)'?\n"
|
||||
#select yn in "Yes" "No"; do
|
||||
#case $yn in
|
||||
#Yes) USER="$(whoami)"; break ;;
|
||||
#No) printf "\n> "; read -r USER; break ;;
|
||||
#esac
|
||||
#done
|
||||
#
|
||||
#if [ -f "packaging/${proj}.ebuild" ]; then
|
||||
#cp packaging/${proj}.ebuild ${proj}-${version}.ebuild
|
||||
#
|
||||
#if [ -x "$(command -v gpg)" ]; then
|
||||
#gpg --detach-sign --yes --local-user "${USER}" ${proj}-${version}.ebuild
|
||||
#fi
|
||||
#
|
||||
#if [ -x "$(command -v md5sum)" ]; then
|
||||
#md5sum ${proj}-${version}.ebuild | cut -d ' ' -f 1 > ${proj}-${version}.ebuild.md5
|
||||
#fi
|
||||
#
|
||||
#if [ -x "$(command -v sha256sum)" ]; then
|
||||
#sha256sum ${proj}-${version}.ebuild | cut -d ' ' -f 1 > ${proj}-${version}.ebuild.sha256
|
||||
#fi
|
||||
#fi
|
||||
#}
|
||||
|
||||
#gen_arch_pkg() {
|
||||
#[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
||||
#[ ! -x "$(command -v makepkg)" ] && printf "makepkg required for this action.\n" && exit 1
|
||||
#
|
||||
#rm -f PKGBUILD
|
||||
#
|
||||
#gen_pkg
|
||||
#
|
||||
#if [ -x "$(command -v md5sum)" ]; then
|
||||
#MD5_SUM="$(md5sum ${proj}-${version}.tar.gz | cut -d ' ' -f 1)"
|
||||
#fi
|
||||
#
|
||||
#if [ -x "$(command -v sha256sum)" ]; then
|
||||
#SHA256_SUM="$(sha256sum ${proj}-${version}.tar.gz | cut -d ' ' -f 1)"
|
||||
#fi
|
||||
#
|
||||
#sed "s/VERSION/${version}/g; s/MD5SUM/$MD5_SUM/g; s/SHA256SUM/$SHA256_SUM/g" packaging/${proj}.PKGBUILD > PKGBUILD
|
||||
#
|
||||
#makepkg -sfr --sign || exit 1
|
||||
#
|
||||
#rm -rf pkg/ src/${proj}-${version}.tar.gz src/${proj}-${version}.tar.gz.sig src/${proj}-${version}
|
||||
#
|
||||
#mv PKGBUILD ${proj}-${version}.PKGBUILD
|
||||
#
|
||||
## generate MD5 checksum
|
||||
#[ -x "$(command -v md5sum)" ] && \
|
||||
#md5sum ${proj}-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > ${proj}-${version}-1-x86_64.pkg.tar.zst.md5
|
||||
#
|
||||
## generate SHA256 checksum
|
||||
#[ -x "$(command -v sha256sum)" ] && \
|
||||
#sha256sum ${proj}-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > ${proj}-${version}-1-x86_64.pkg.tar.zst.sha256
|
||||
#}
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
$0 - Wrapper script for generating distro packages
|
||||
|
@ -147,6 +84,7 @@ main() {
|
|||
"clean") clean ;;
|
||||
"help") help ;;
|
||||
"dist") gen_pkg ;;
|
||||
"dist_release") gen_pkg "release";
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
Loading…
Reference in a new issue