Creating OpenWrt webfilter-ng package
Opened this issue · 0 comments
BSN32 commented
Hi , thanks for great project it helped me filter web sites without using ssl inspection.
I run this on OpenWrt here is my simple package .
anynody feel free to use this package Makefile
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=webfilter-ng
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=luigi1809
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/alfa/Desktop/nfqueue/webfilter-ng
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=https://github.com/luigi1809/webfilter-ng.git
#PKG_SOURCE_VERSION:=e7bd8ec6fae9aff0d09462e8618da37194f7f021
include $(INCLUDE_DIR)/package.mk
# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/webfilter-ng
SECTION:=net
CATEGORY:=Network
TITLE:=Transparent SNI Web filtering using NFQUEUE
DEPENDS:=+libnfnetlink +libnetfilter-queue +iptables-mod-nfqueue
endef
# Package description; a more verbose description on what our package does
define Package/webfilter-ng/description
Transparent Web Filtering for Linux.
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
$(TARGET_CC) -D_GNU_SOURCE $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/webfilter-ng.o -c $(PKG_BUILD_DIR)/webfilter-ng.c -lnetfilter_queue -lnfnetlink
$(TARGET_CC) -D_GNU_SOURCE $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/webfilter-ng.o -lnetfilter_queue -lnfnetlink
endef
# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/webfilter-ng/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/webfilter-ng $(1)/usr/bin
endef
# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,webfilter-ng))