summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 34ab29f30c72d3f78f5a204bfcd0b6cd24562fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Maintainer: OpenJowel <OpenJowel AT proton DOT me>
#
# This package installs the restbed library on the system
# I am not responsible for the code itself. This package is only an automated build/installation of the restbed library
# Technical questions or issues related to the library itself have to be addressed to the contributors

_tag="4.8"

pkgname="restbed"
arch=('i686' 'x86_64')
pkgver=4.8.r0.g5817f08
pkgrel=4
pkgdesc="Framework bringing asynchronous RESTful functionality to C++14 applications"
url='https://github.com/Corvusoft/restbed'
license=('AGPL' 'CPL')
options=('staticlibs')
source=(
  "git+https://github.com/Corvusoft/restbed#tag=${_tag}"
  "git+https://github.com/corvusoft/asio-dependency"
  "git+https://github.com/corvusoft/catch-dependency"
  "git+https://github.com/corvusoft/openssl-dependency"
)
sha512sums=(
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
)
makedepends=('git' 'cmake')


pkgver(){
  cd "$pkgname"
  git describe --long --tags | sed -r 's/([^-]*-g)/r\1/;s/-/./g'
}


build(){
  cd "${pkgname}"

  # BEGIN HOTFIX : There is a project version error in the CMakeLists for version 4.8. The following block is here to fix it
  if [ ${_tag} = "4.8" ]; then
    echo "Fixing version in CMakeLists.txt"
    sed -i "s/project( \"restbed\" VERSION 4.7.0 LANGUAGES CXX )/project( \"restbed\" VERSION ${_tag}.0 LANGUAGES CXX )/g" CMakeLists.txt
  fi
  # END HOTFIX

  mkdir -p build && cd build
  cmake -DBUILD_SSL=NO -DBUILD_TESTS=NO ..

  make -j4
  make install
}


package() {
  libPrefix="lib"
  libBasename=${libPrefix}${pkgname}
  fullSoName=${libBasename}.so.${_tag}
  majorSoName=$(echo -n ${fullSoName} | awk 'match($0, /[a-zA-Z0-9]+(.so)\.[0-9]+/) {print substr($0, RSTART, RLENGTH)}')
  shortSoName=$(echo -n ${fullSoName} | awk 'match($0, /[a-zA-Z0-9]+(.so)/) {print substr($0, RSTART, RLENGTH)}')

  mkdir -p ${pkgdir}/usr/lib
  cp ${pkgname}/distribution/library/librestbed.so.${_tag} ${pkgdir}/usr/lib/
  ln -s /usr/lib/${fullSoName} ${pkgdir}/usr/lib/${majorSoName}
  ln -s /usr/lib/${fullSoName} ${pkgdir}/usr/lib/${shortSoName}

  # The static lib would need a -fPIC flag to be relevant. Let's not mess at linking and just ignore it
  #cp ${pkgname}/distribution/library/${libBasename}.a ${pkgdir}/usr/lib/${libBasename}.a

  mkdir -p ${pkgdir}/usr/include
  cp -r ${pkgname}/distribution/include/* ${pkgdir}/usr/include/
}