Browse Source

Added automatic package generation

tastytea 3 weeks ago
parent
commit
3c185e7ae5
Signed by: tastytea <tastytea@tastytea.de> GPG Key ID: CFC39497F1B26E07
4 changed files with 126 additions and 3 deletions
  1. 58
    0
      .drone.yml
  2. 2
    0
      CMakeLists.txt
  3. 22
    3
      README.md
  4. 44
    0
      packages.CMakeLists.txt

+ 58
- 0
.drone.yml View File

@@ -1,4 +1,39 @@
1 1
 pipeline:
2
+  build_package:
3
+    image: ubuntu:trusty
4
+    pull: true
5
+    when:
6
+      event: tag
7
+    environment:
8
+      - LANG=C.utf8
9
+      - CXX=g++-5
10
+      - CXXFLAGS=-pipe -O2
11
+    commands:
12
+      - rm /etc/apt/apt.conf.d/docker-clean
13
+      - echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" >> /etc/apt/sources.list.d/ubuntu-toolchain-r.list
14
+      - gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0x60c317803a41ba51845e371a1e9377a2ba9ef27f
15
+      - gpg --armor --export 0x60c317803a41ba51845e371a1e9377a2ba9ef27f | apt-key add -
16
+      - apt-get update -q
17
+      - apt-get install -qy g++-5 cmake3 pkg-config
18
+      - apt-get install -qy libcrypto++-dev libmagick++-dev libxdg-basedir-dev
19
+      - apt-get install -qy dpkg-dev d-shlibs rpm file wget
20
+      - gpg --import /var/autosign_gpg.key
21
+      - rm -rf build && mkdir -p build && cd build
22
+      - cmake -DCMAKE_INSTALL_PREFIX=/usr ..
23
+      - make VERBOSE=1
24
+      - make install DESTDIR=install
25
+      - make package
26
+      - cmake -DWITH_DEB=ON ..
27
+      - make package
28
+      - cmake -DWITH_DEB=OFF -DWITH_RPM=ON ..
29
+      - make package
30
+      - gpg --verbose --detach-sign *.tar.gz
31
+      - gpg --verbose --detach-sign *.deb
32
+      - gpg --verbose --detach-sign *.rpm
33
+    volumes:
34
+      - /var/cache/debian-package-cache:/var/cache/apt/archives
35
+      - /home/tastytea/misc/autosign_gpg.key:/var/autosign_gpg.key
36
+
2 37
   gcc5:
3 38
     image: debian:stretch-slim
4 39
     pull: true
@@ -29,6 +64,8 @@ pipeline:
29 64
   gcc6:
30 65
     image: debian:stretch-slim
31 66
     pull: true
67
+    when:
68
+      event: [push, pull_request]
32 69
     environment:
33 70
       - LANG=C.utf8
34 71
       - CXX=g++-6
@@ -144,6 +181,18 @@ pipeline:
144 181
     volumes:
145 182
       - /var/cache/debian-package-cache:/var/cache/apt/archives
146 183
 
184
+  prepare_release:
185
+    image: ubuntu:xenial
186
+    pull: true
187
+    when:
188
+      event: tag
189
+    commands:
190
+      - cp -v build/libravatarserv-${DRONE_TAG}_x86_64.tar.gz .
191
+      - cp -v build/libravatarserv-${DRONE_TAG}_x86_64.tar.gz.sig .
192
+      - cp -v build/libravatarserv_${DRONE_TAG}-0_amd64.deb .
193
+      - cp -v build/libravatarserv_${DRONE_TAG}-0_amd64.deb.sig .
194
+      - cp -v build/libravatarserv-${DRONE_TAG}-0.x86_64.rpm .
195
+      - cp -v build/libravatarserv-${DRONE_TAG}-0.x86_64.rpm.sig .
147 196
   gitea_release:
148 197
     image: plugins/gitea-release
149 198
     pull: true
@@ -153,6 +202,15 @@ pipeline:
153 202
     secrets: [ gitea_token ]
154 203
     title: ${DRONE_TAG}
155 204
     prerelease: true
205
+    files:
206
+      - libravatarserv-${DRONE_TAG}_x86_64.tar.gz
207
+      - libravatarserv-${DRONE_TAG}_x86_64.tar.gz.sig
208
+      - libravatarserv_${DRONE_TAG}-0_amd64.deb
209
+      - libravatarserv_${DRONE_TAG}-0_amd64.deb.sig
210
+      - libravatarserv-${DRONE_TAG}-0.x86_64.rpm
211
+      - libravatarserv-${DRONE_TAG}-0.x86_64.rpm.sig
212
+    checksum:
213
+      - sha512
156 214
 
157 215
   notify:
158 216
     image: drillster/drone-email

+ 2
- 0
CMakeLists.txt View File

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

+ 22
- 3
README.md View File

@@ -65,16 +65,35 @@ The avatar directory could look like this:
65 65
 
66 66
 ## Install
67 67
 
68
-### Dependencies
68
+### Gentoo
69
+
70
+Gentoo ebuilds are available via my
71
+[repository](https://schlomp.space/tastytea/overlay).
72
+
73
+### Automatically generated packages
74
+
75
+Binary packages are generated automatically for each
76
+[release](https://schlomp.space/tastytea/libravatarserv/releases) in the
77
+formats:
78
+
79
+* deb
80
+* rpm
81
+* tar.gz
82
+
83
+They are generated on Ubuntu Trusty 64 bit.
84
+
85
+### From source
86
+
87
+#### Dependencies
69 88
 
70 89
 * C++ compiler (tested: [gcc](https://gcc.gnu.org/) 5/6/7/8,
71 90
   [clang](https://llvm.org/) 5/6)
72 91
 * [cmake](https://cmake.org/) (at least 3.2)
73 92
 * [crypto++](https://cryptopp.com) (tested: 7.0 / 5.6)
74
-* [imagemagick](https://www.imagemagick.org/) (tested: 7.0 / 6.9)
93
+* [imagemagick](https://www.imagemagick.org/) (tested: 7.0 / 6.7)
75 94
 * [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
76 95
 
77
-### Compile
96
+#### Compile
78 97
 
79 98
 ```SH
80 99
 mkdir build

+ 44
- 0
packages.CMakeLists.txt View File

@@ -0,0 +1,44 @@
1
+# Packages
2
+set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
3
+set(CPACK_PACKAGE_VERSION_MAJOR ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR})
4
+set(CPACK_PACKAGE_VERSION_MINOR ${${CMAKE_PROJECT_NAME}_VERSION_MINOR})
5
+set(CPACK_PACKAGE_VERSION_PATCH ${${CMAKE_PROJECT_NAME}_VERSION_PATCH})
6
+set(CPACK_PACKAGE_VERSION ${${CMAKE_PROJECT_NAME}_VERSION})
7
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple libravatar server.")
8
+set(CPACK_PACKAGE_CONTACT "tastytea <tastytea@tastytea.de>")
9
+set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
10
+set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
11
+list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git"
12
+                                      "/.gitignore"
13
+                                      "/build/"
14
+                                      "\\\\.sublime-"
15
+                                      "/.drone.yml")
16
+execute_process(COMMAND uname -m
17
+                OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE
18
+                OUTPUT_STRIP_TRAILING_WHITESPACE)
19
+set(CPACK_PACKAGE_FILE_NAME
20
+    "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_PACKAGE_ARCHITECTURE}")
21
+set(CPACK_GENERATOR "TGZ")
22
+set(CPACK_SOURCE_GENERATOR "TGZ")
23
+
24
+if (WITH_DEB)
25
+    set(CPACK_GENERATOR "DEB")
26
+    set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://schlomp.space/tastytea/${CMAKE_PROJECT_NAME}")
27
+    set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
28
+    execute_process(COMMAND dpkg --print-architecture
29
+                    OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
30
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
31
+    set(CPACK_PACKAGE_FILE_NAME
32
+        "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-0_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
33
+endif()
34
+
35
+if (WITH_RPM)
36
+    set(CPACK_GENERATOR "RPM")
37
+    set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
38
+    set(CPACK_RPM_PACKAGE_URL "https://schlomp.space/tastytea/${CMAKE_PROJECT_NAME}")
39
+    set(CPACK_RPM_PACKAGE_REQUIRES "cryptopp++, libMagick++, libxdg-basedir >= 1.2.0")
40
+    set(CPACK_PACKAGE_FILE_NAME
41
+         "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-0.${CPACK_PACKAGE_ARCHITECTURE}")
42
+endif()
43
+
44
+include(CPack)

Loading…
Cancel
Save