From 863ae42233e901d7d463e74e3c61a00b425572a0 Mon Sep 17 00:00:00 2001 From: cinerea0 Date: Sat, 28 Aug 2021 01:21:23 -0400 Subject: [PATCH] New package: opensnitch-1.3.6 --- srcpkgs/opensnitch/files/opensnitchd/run | 4 ++ srcpkgs/opensnitch/patches/cc-check.patch | 13 +++++ srcpkgs/opensnitch/patches/musl-int.patch | 16 ++++++ srcpkgs/opensnitch/template | 68 +++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 srcpkgs/opensnitch/files/opensnitchd/run create mode 100644 srcpkgs/opensnitch/patches/cc-check.patch create mode 100644 srcpkgs/opensnitch/patches/musl-int.patch create mode 100644 srcpkgs/opensnitch/template diff --git a/srcpkgs/opensnitch/files/opensnitchd/run b/srcpkgs/opensnitch/files/opensnitchd/run new file mode 100644 index 000000000000..2c1855eef621 --- /dev/null +++ b/srcpkgs/opensnitch/files/opensnitchd/run @@ -0,0 +1,4 @@ +#!/bin/sh + +[ -r conf ] && . ./conf +exec opensnitchd ${OPTS:--rules-path /etc/opensnitchd/rules} diff --git a/srcpkgs/opensnitch/patches/cc-check.patch b/srcpkgs/opensnitch/patches/cc-check.patch new file mode 100644 index 000000000000..4a9aa09b5e2a --- /dev/null +++ b/srcpkgs/opensnitch/patches/cc-check.patch @@ -0,0 +1,13 @@ +diff --git a/daemon/netfilter/queue.go b/daemon/netfilter/queue.go +index 3797486baf..4ee09d68b5 100644 +--- a/daemon/netfilter/queue.go ++++ b/daemon/netfilter/queue.go +@@ -3,7 +3,7 @@ package netfilter + /* + #cgo pkg-config: libnetfilter_queue + #cgo CFLAGS: -Wall -I/usr/include +-#cgo LDFLAGS: -L/usr/lib64/ -ldl ++#cgo LDFLAGS: -L/usr/lib64 -ldl + + #include "queue.h" + */ diff --git a/srcpkgs/opensnitch/patches/musl-int.patch b/srcpkgs/opensnitch/patches/musl-int.patch new file mode 100644 index 000000000000..360e26c98179 --- /dev/null +++ b/srcpkgs/opensnitch/patches/musl-int.patch @@ -0,0 +1,16 @@ +diff --git a/daemon/netfilter/queue.h b/daemon/netfilter/queue.h +index 64c3ea7c0c..2ced3bb39e 100644 +--- a/daemon/netfilter/queue.h ++++ b/daemon/netfilter/queue.h +@@ -14,6 +14,11 @@ + #include + #include + ++typedef unsigned int uint; ++typedef uint8_t u_int8_t; ++typedef uint16_t u_int16_t; ++typedef uint32_t u_int32_t; ++ + typedef struct { + uint verdict; + uint mark; diff --git a/srcpkgs/opensnitch/template b/srcpkgs/opensnitch/template new file mode 100644 index 000000000000..77b5a3f2c2ba --- /dev/null +++ b/srcpkgs/opensnitch/template @@ -0,0 +1,68 @@ +# Template file for 'opensnitch' +pkgname=opensnitch +version=1.3.6 +revision=1 +build_wrksrc="daemon" +build_style=go +go_import_path="github.com/evilsocket/opensnitch/daemon" +go_package="${go_import_path}" +go_mod_mode="mod" +hostmakedepends="pkg-config python3-setuptools" +makedepends="libnetfilter_queue-devel python3-devel" +depends="python3-grpcio-tools python3-slugify python3-inotify + python3-PyQt5 python3-PyQt5-sql qt5-wayland qt5-plugin-sqlite" +conf_files="/etc/opensnitchd/default-config.json + /etc/opensnitchd/system-fw.json" +make_dirs="/etc/opensnitchd/rules/ 0755 root root + /etc/opensnitchd/ 0755 root root" +short_desc="GNU/Linux port of the Little Snitch application firewall" +maintainer="cinerea0 " +license="GPL-3.0-only" +homepage="https://github.com/evilsocket/opensnitch" +distfiles="https://github.com/evilsocket/opensnitch/archive/refs/tags/v${version}.tar.gz" +checksum=a02e49a5ed79db8f21788188f16a28684d5f54f583bb4d338e3386484ee1663a + +_py() { + cd ../ui + if [ -n "$CROSS_BUILD" ]; then + PYPREFIX="$XBPS_CROSS_BASE" + CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include" + LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib" + CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS" + LDSHARED="${CC} -shared $LDFLAGS" + for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do + f=${f##*/} + _PYTHON_SYSCONFIGDATA_NAME=${f%.py} + done + env CC="$CC" LDSHARED="$LDSHARED" \ + PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \ + PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \ + _PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \ + LDFLAGS="$LDFLAGS" python3 setup.py \ + ${@:-install --prefix=/usr --root=${DESTDIR}} ${make_install_args} + else + python3 setup.py ${@:-install --prefix=/usr --root=${DESTDIR}} ${make_install_args} + fi +} + +post_build() { + # build ui + _py build +} + +do_install() { + # rename bin daemon to opensnitchd + for f in ${GOPATH}/bin/* ${GOPATH}/bin/**/*; do + if [ -f "$f" ] && [ -x "$f" ]; then + vbin "$f" opensnitchd + break + fi + done + + vinstall "default-config.json" 644 "/etc/opensnitchd/" + vinstall "system-fw.json" 644 "/etc/opensnitchd/" + vsv opensnitchd + + #install ui + _py +}