From da9944078cc8b5f94422761026bac7815c8b550d Mon Sep 17 00:00:00 2001 From: Anubhav Kini Date: Wed, 12 May 2021 14:03:59 +0530 Subject: [PATCH] New package: opensnitch-1.3.6 --- srcpkgs/opensnitch/files/opensnitchd/run | 3 + srcpkgs/opensnitch/patches/cc-check.patch | 11 ++++ srcpkgs/opensnitch/patches/musl-int.patch | 14 +++++ srcpkgs/opensnitch/template | 72 +++++++++++++++++++++++ 4 files changed, 100 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..d9aa34169f54 --- /dev/null +++ b/srcpkgs/opensnitch/files/opensnitchd/run @@ -0,0 +1,3 @@ +#!/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..470dd5ecffb4 --- /dev/null +++ b/srcpkgs/opensnitch/patches/cc-check.patch @@ -0,0 +1,11 @@ +--- daemon/netfilter/queue.go ++++ 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..ce6af3c6e4c7 --- /dev/null +++ b/srcpkgs/opensnitch/patches/musl-int.patch @@ -0,0 +1,14 @@ +--- daemon/netfilter/queue.h ++++ 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..e0d5701c5a7f --- /dev/null +++ b/srcpkgs/opensnitch/template @@ -0,0 +1,72 @@ +# 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="Anubhav Kini " +license="GPL-3.0-only" +homepage="https://github.com/evilsocket/opensnitch" +distfiles="${homepage}/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 + if [ -f "${GOPATH}/bin/daemon" ]; then + vbin "${GOPATH}/bin/daemon" opensnitchd + else + for d in ${GOPATH}/bin/**; do + if [ -f "${GOPATH}/bin/$d/daemon" ]; then + vbin "${GOPATH}/bin/$d/daemon" opensnitchd + break + fi + done + fi + + vinstall "default-config.json" 644 "/etc/opensnitchd/" + vinstall "system-fw.json" 644 "/etc/opensnitchd/" + vsv opensnitchd + + #install ui + _py +}