Added automatic package generation

This commit is contained in:
tastytea 2018-11-27 05:46:45 +01:00
parent 8cc6e73cb1
commit 3c185e7ae5
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 126 additions and 3 deletions

View File

@ -1,4 +1,39 @@
pipeline:
build_package:
image: ubuntu:trusty
pull: true
when:
event: tag
environment:
- LANG=C.utf8
- CXX=g++-5
- CXXFLAGS=-pipe -O2
commands:
- rm /etc/apt/apt.conf.d/docker-clean
- echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" >> /etc/apt/sources.list.d/ubuntu-toolchain-r.list
- gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0x60c317803a41ba51845e371a1e9377a2ba9ef27f
- gpg --armor --export 0x60c317803a41ba51845e371a1e9377a2ba9ef27f | apt-key add -
- apt-get update -q
- apt-get install -qy g++-5 cmake3 pkg-config
- apt-get install -qy libcrypto++-dev libmagick++-dev libxdg-basedir-dev
- apt-get install -qy dpkg-dev d-shlibs rpm file wget
- gpg --import /var/autosign_gpg.key
- rm -rf build && mkdir -p build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=/usr ..
- make VERBOSE=1
- make install DESTDIR=install
- make package
- cmake -DWITH_DEB=ON ..
- make package
- cmake -DWITH_DEB=OFF -DWITH_RPM=ON ..
- make package
- gpg --verbose --detach-sign *.tar.gz
- gpg --verbose --detach-sign *.deb
- gpg --verbose --detach-sign *.rpm
volumes:
- /var/cache/debian-package-cache:/var/cache/apt/archives
- /home/tastytea/misc/autosign_gpg.key:/var/autosign_gpg.key
gcc5:
image: debian:stretch-slim
pull: true
@ -29,6 +64,8 @@ pipeline:
gcc6:
image: debian:stretch-slim
pull: true
when:
event: [push, pull_request]
environment:
- LANG=C.utf8
- CXX=g++-6
@ -144,6 +181,18 @@ pipeline:
volumes:
- /var/cache/debian-package-cache:/var/cache/apt/archives
prepare_release:
image: ubuntu:xenial
pull: true
when:
event: tag
commands:
- cp -v build/libravatarserv-${DRONE_TAG}_x86_64.tar.gz .
- cp -v build/libravatarserv-${DRONE_TAG}_x86_64.tar.gz.sig .
- cp -v build/libravatarserv_${DRONE_TAG}-0_amd64.deb .
- cp -v build/libravatarserv_${DRONE_TAG}-0_amd64.deb.sig .
- cp -v build/libravatarserv-${DRONE_TAG}-0.x86_64.rpm .
- cp -v build/libravatarserv-${DRONE_TAG}-0.x86_64.rpm.sig .
gitea_release:
image: plugins/gitea-release
pull: true
@ -153,6 +202,15 @@ pipeline:
secrets: [ gitea_token ]
title: ${DRONE_TAG}
prerelease: true
files:
- libravatarserv-${DRONE_TAG}_x86_64.tar.gz
- libravatarserv-${DRONE_TAG}_x86_64.tar.gz.sig
- libravatarserv_${DRONE_TAG}-0_amd64.deb
- libravatarserv_${DRONE_TAG}-0_amd64.deb.sig
- libravatarserv-${DRONE_TAG}-0.x86_64.rpm
- libravatarserv-${DRONE_TAG}-0.x86_64.rpm.sig
checksum:
- sha512
notify:
image: drillster/drone-email

View File

@ -44,3 +44,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
"${MAGICPP_LDFLAGS} ${LIBCRYPTOPP_LDFLAGS}"
"${LIBXDG_BASEDIR_LDFLAGS} -lstdc++fs")
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
include(packages.CMakeLists.txt)

View File

@ -65,16 +65,35 @@ The avatar directory could look like this:
## Install
### Dependencies
### Gentoo
Gentoo ebuilds are available via my
[repository](https://schlomp.space/tastytea/overlay).
### Automatically generated packages
Binary packages are generated automatically for each
[release](https://schlomp.space/tastytea/libravatarserv/releases) in the
formats:
* deb
* rpm
* tar.gz
They are generated on Ubuntu Trusty 64 bit.
### From source
#### Dependencies
* C++ compiler (tested: [gcc](https://gcc.gnu.org/) 5/6/7/8,
[clang](https://llvm.org/) 5/6)
* [cmake](https://cmake.org/) (at least 3.2)
* [crypto++](https://cryptopp.com) (tested: 7.0 / 5.6)
* [imagemagick](https://www.imagemagick.org/) (tested: 7.0 / 6.9)
* [imagemagick](https://www.imagemagick.org/) (tested: 7.0 / 6.7)
* [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
### Compile
#### Compile
```SH
mkdir build

44
packages.CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
# Packages
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${${CMAKE_PROJECT_NAME}_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${${CMAKE_PROJECT_NAME}_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${${CMAKE_PROJECT_NAME}_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple libravatar server.")
set(CPACK_PACKAGE_CONTACT "tastytea <tastytea@tastytea.de>")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git"
"/.gitignore"
"/build/"
"\\\\.sublime-"
"/.drone.yml")
execute_process(COMMAND uname -m
OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_PACKAGE_ARCHITECTURE}")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
if (WITH_DEB)
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://schlomp.space/tastytea/${CMAKE_PROJECT_NAME}")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
execute_process(COMMAND dpkg --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-0_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
endif()
if (WITH_RPM)
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
set(CPACK_RPM_PACKAGE_URL "https://schlomp.space/tastytea/${CMAKE_PROJECT_NAME}")
set(CPACK_RPM_PACKAGE_REQUIRES "cryptopp++, libMagick++, libxdg-basedir >= 1.2.0")
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-0.${CPACK_PACKAGE_ARCHITECTURE}")
endif()
include(CPack)