summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 73c1cfc361cef1621469f4c1741fa0eebc864d25 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Maintainer: Darren Wu <$(base64 --decode <<<'ZGFycmVuMTk5NzA4MTBAZ21haWwuY29tCg==')>
# Contributor: wenLiangcan <boxeed at gmail dot com>

pkgname="pcap-dnsproxy-git"
pkgver=0.4.9.13.r0.g70a40bb
pkgrel=1
epoch=1 # default value if left unspecified is 0
pkgdesc="A local DNS server base on WinPcap and LibPcap."
arch=('x86_64') # 'i686' untested
url="https://github.com/chengr28/Pcap_DNSProxy"
license=('GPL2')
depends=(
  'libevent>=2.1.8'
  'libpcap'
  'libsodium>=1.0.16'
  'openssl>=1.0.2'
)
makedepends=('git' 'cmake' 'm4' 'bison' 'flex' 'gcc')
provides=("${pkgname%-git}" "${pkgname%-git}-bin")
conflicts=("${pkgname%-git}" "${pkgname%-git}-bin")
backup=(
  "etc/systemd/system/Pcap_DNSProxy.service"
  "etc/${pkgname%-git}/Config.conf"
  "etc/${pkgname%-git}/Hosts.conf"
  "etc/${pkgname%-git}/IPFilter.conf"
  "etc/${pkgname%-git}/Routing.txt"
  "etc/${pkgname%-git}/WhiteList.txt"
)
source=(
  "${pkgname%-git}::git+git://github.com/Lyoko-Jeremie/Pcap_DNSProxy.git"
  "make.patch"
  "service.patch"
)
md5sums=(
  'SKIP'
  '7d59b750c7375bb77bcb2b6fae326e3b'
  'abe842d6182ec4be0cc5130433146129'
)

pkgver() {
  cd "${srcdir}/${pkgname%-git}"
  # cutting off 'v' prefix that presents in the git tag
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {

  cd "${srcdir}/${pkgname%-git}"

  patch --verbose Source/Auxiliary/Scripts/CMake_Build.sh "${srcdir}/make.patch"
  patch --verbose Source/Auxiliary/ExampleConfig/Pcap_DNSProxy.service "${srcdir}/service.patch"

  find . \
    \( \
      -name '*.zh-Hans.*' -o \
      -name '*.zh-Hant.*' -o \
      -name '*.SysV.*' -o \
      -name 'PcapDNSProxyService' -o \
      -name 'Linux_Install.Systemd.sh' -o \
      -name 'Linux_Uninstall.Systemd.sh' -o \
      \( \
        \( \
          -name '*.sln' -o \
          -name '*.vcxproj*' -o \
          -name '*.xcodeproj' -o \
          -name '*macOS*' -o \
          -name '*Windows*' \
        \) -a -not -iname '*linux*' \
      \) \
    \) \
    -prune -exec rm -rfv {} \;

  mv -v README.md Documents/
}

build() {
  cd "${srcdir}/${pkgname%-git}/Source/Auxiliary/Scripts"
  chmod +x CMake_Build.sh
  time ./CMake_Build.sh
}

package() {

  cd "${srcdir}/${pkgname%-git}/Source/Release"

  install -dm755 "${pkgdir}/usr/share/doc/${pkgname%-git}"
  install -Dm644 "${srcdir}/${pkgname%-git}/Documents"/* "${pkgdir}/usr/share/doc/${pkgname%-git}/"

  install -dm755  "${pkgdir}/etc/systemd/system"
  install -Dm644 Pcap_DNSProxy.service "${pkgdir}/etc/systemd/system/"

  install -dm755 "${pkgdir}/usr/bin/"
  install -Dm755 \
    Pcap_DNSProxy \
    Tools/Update_Routing.sh \
    Tools/Update_WhiteList.sh \
    "${pkgdir}/usr/bin/"

  install -dm755 "$pkgdir/etc/${pkgname%-git}/"
  install -Dm644 \
    Config.conf \
    Hosts.conf \
    IPFilter.conf \
    Routing.txt \
    WhiteList.txt \
    "$pkgdir/etc/${pkgname%-git}/"

}