summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Resch2018-08-26 17:37:50 +0200
committerMax Resch2018-08-26 17:37:50 +0200
commit4d2de30695b48b20ff961c8fa858a3782e05b6b6 (patch)
tree1d0e8582003c8029f5936a55b501e299aff089dc
parentad52e259429719ccf768d7b73b31b8f8f172b9ed (diff)
downloadaur-4d2de30695b48b20ff961c8fa858a3782e05b6b6.tar.gz
use debian source, use capabilities
-rw-r--r--PKGBUILD39
-rw-r--r--bing.install9
-rw-r--r--makefile.patch15
-rw-r--r--memcpy.patch12
4 files changed, 60 insertions, 15 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 3b073cc464f1..e8e0a0563013 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,26 +1,35 @@
-# Contributor: Max Resch <mxr@users.sourceforge.net>
+# Contributor: Max Resch <resch.max@gmail.com>
# Thanks To: audrencezar
pkgname=bing
-pkgver=1.1.3
-pkgrel=4
+pkgver=1.3.5
+pkgrel=1
pkgdesc="Measure the bandwidth between two hosts using the ICMP protocol without the need of a client/server architecture"
arch=('i686' 'x86_64')
url="http://fgouget.free.fr/bing/bing_src-readme-1st.shtml"
license=('BSD')
-depends=('glibc')
-source=("https://launchpad.net/ubuntu/+archive/primary/+files/${pkgname}_${pkgver}.orig.tar.gz"
- "https://launchpad.net/ubuntu/+archive/primary/+files/${pkgname}_${pkgver}-2.diff.gz")
-sha256sums=('318865a38aac472e03ba44dd34ba2bf0c535f46187a22a3075be466b293e55c3'
- '103e0912088150ac89c2690e1f6faca9deb2787b7057aa87cf28cc7412333c49')
+optdepends=('libcap: for setting cap_net_raw')
+source=(
+ "http://http.debian.net/debian/pool/main/b/bing/${pkgname}_${pkgver}.orig.tar.gz"
+ "makefile.patch"
+ "memcpy.patch" )
+sha256sums=(
+ '12bbf7f869474691f8d1f42aaa28547b2eee338576397dccd9d5bf862fc90768'
+ 'be1874bb8d39021f072409d4c52291da71e36edca9762b5cbc631b597422e57b'
+ '170ce4b0cb4696b719d567721798b388900c2c646fffc15d3b3b1bf19b67554d' )
+install="${pkgname}.install" # setcap cap_net_raw or setuid root
+
build() {
- cd $srcdir/$pkgname-$pkgver
- patch -p1 -i ${srcdir}/${pkgname}_${pkgver}-2.diff
- make || return 1
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ # add #include<string.h> to avoid missing memcpy() warning
+ patch -p1 < ${srcdir}/memcpy.patch
+ # remove debug build flags
+ patch -p1 < ${srcdir}/makefile.patch
+ CFLAGS="$(CFLAGS) -fPIC -D_FORTIFY_SOURCE=2" LDFLAGS="$(LDFLAGS) -Wl,-z,relro,-z,now -pie" make
+ gzip -k unix/bing.8
}
package() {
- cd $srcdir/$pkgname-$pkgver
- install -D -o root -g root -m 4555 bing $pkgdir/usr/bin/bing || return 1
- install -D -o root -g root -m 0644 unix/bing.8 $pkgdir/usr/share/man/man8/bing.8 || return 1
+ cd ${srcdir}/${pkgname}-${pkgver}
+ install -D -o root -g root -m 0755 bing ${pkgdir}/usr/bin/bing
+ install -D -o root -g root -m 0644 unix/bing.8.gz ${pkgdir}/usr/share/man/man8/bing.8.gz
}
-
diff --git a/bing.install b/bing.install
new file mode 100644
index 000000000000..e146bb582b2b
--- /dev/null
+++ b/bing.install
@@ -0,0 +1,9 @@
+
+post_install() {
+ setcap cap_net_raw=ep usr/bin/bing 2>/dev/null || chmod +s usr/bin/ping
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
diff --git a/makefile.patch b/makefile.patch
new file mode 100644
index 000000000000..fd9c2895ab1f
--- /dev/null
+++ b/makefile.patch
@@ -0,0 +1,15 @@
+diff -u bing-1.3.5.orig/Makefile bing-1.3.5/Makefile
+--- bing-1.3.5.orig/Makefile 1999-10-26 08:42:16.000000000 +0200
++++ bing-1.3.5/Makefile 2018-08-26 17:22:36.976401721 +0200
+@@ -46,9 +46,9 @@
+ # You may optionally provide some optimisation flags. Optimising bing for
+ # speed should slightly improve the results.
+ # -> if you want to debug bing define
+-COPTIM = -g -Wall -D_DEBUG
++#COPTIM = -g -Wall -D_DEBUG
+ # -> on Linux, SunOS 4 and OSF1 V2.0 you may specify
+-#COPTIM = -O2
++COPTIM = -O2
+ # -> on Solaris you may use
+ #COPTIM = -O
+ # on some hosts like AIX, HP-UX the optimisation options are already set
diff --git a/memcpy.patch b/memcpy.patch
new file mode 100644
index 000000000000..8ca7d6b4db46
--- /dev/null
+++ b/memcpy.patch
@@ -0,0 +1,12 @@
+diff -u bing-1.3.5/bing_probes.c bing-1.3.5_n/bing_probes.c
+--- bing-1.3.5.orig/bing_probes.c 1999-10-26 08:42:16.000000000 +0200
++++ bing-1.3.5/bing_probes.c 2018-08-26 17:13:15.156726035 +0200
+@@ -7,6 +7,7 @@
+ /* $Id: bing_probes.c,v 1.12 1999/10/24 23:28:14 fgouget Exp $ */
+
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
+ #include <malloc.h>
+ #include <stdlib.h>
+