summaryrefslogtreecommitdiffstats
path: root/net/privoxy/Makefile
blob: a9fcb6a3eaa443e71e9d3b22bb783d05dd1592f2 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=privoxy
PKG_VERSION:=3.0.24
PKG_RELEASE:=1

PKG_SOURCE:=privoxy-$(PKG_VERSION)-stable-src.tar.gz
PKG_SOURCE_URL:=@SF/ijbswa
PKG_MD5SUM:=44a47d1a5000db8cccd61ace0e25e7f7
PKG_BUILD_DIR:=$(BUILD_DIR)/privoxy-$(PKG_VERSION)-stable
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE

PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>

PKG_CONFIG_DEPENDS:= \
  CONFIG_IPV6 \
  \
  CONFIG_PRIVOXY_disable-pthread \
  CONFIG_PRIVOXY_disable-dynamic-pcre \
  CONFIG_PRIVOXY_disable-zlib \
  \
  CONFIG_PRIVOXY_disable-toggle \
  CONFIG_PRIVOXY_disable-force \
  CONFIG_PRIVOXY_disable-fast-redirects \
  CONFIG_PRIVOXY_disable-stats \
  CONFIG_PRIVOXY_enable-ie-images \
  CONFIG_PRIVOXY_disable-image-blocking \
  CONFIG_PRIVOXY_disable-acl-support \
  CONFIG_PRIVOXY_disable-trust-files \
  CONFIG_PRIVOXY_disable-editor \
  CONFIG_PRIVOXY_enable-no-gifs \
  CONFIG_PRIVOXY_enable-graceful-termination \
  CONFIG_PRIVOXY_enable-extended-host-patterns \
  CONFIG_PRIVOXY_enable-external-filters \
  CONFIG_PRIVOXY_enable-accept-filter \
  CONFIG_PRIVOXY_enable-strptime-sanity-checks \
  CONFIG_PRIVOXY_enable-compression

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=Web Servers/Proxies
  TITLE:=Privoxy WEB Proxy
  URL:=http://www.privoxy.org/
  USERID:=privoxy=8118:privoxy=8118
  MENU:=1
  DEPENDS:=+!PRIVOXY_no_pcre:libpcre +!PRIVOXY_no_pthread:libpthread +!PRIVOXY_no_zlib:zlib
endef

# shown in LuCI package description
define Package/$(PKG_NAME)/description
$(TITLE) - Homepage: www.privoxy.org
endef

# shown in make menuconfig <Help>
define Package/$(PKG_NAME)/config
	help
		Privoxy is a web proxy with advanced filtering capabilities for protecting
		privacy, modifying web page content, managing cookies, controlling access,
		and removing ads, banners, pop-ups and other obnoxious Internet junk.
		Privoxy has a very flexible configuration and can be customized to suit
		individual needs and tastes.
		Privoxy has application for both stand-alone systems and multi-user networks.
		Run as : $(USERID)
		Version: $(PKG_VERSION)-$(PKG_RELEASE)
		Home   : $(URL)
		$(PKG_MAINTAINER)

	source "$(SOURCE)/Config.in"
endef

CONFIGURE_ARGS += \
	--sysconfdir=/etc/privoxy \
	$(if $(CONFIG_IPV6),,--disable-ipv6-support) \
	\
	$(if $(CONFIG_PRIVOXY_disable-pthread),--disable-pthread) \
	$(if $(CONFIG_PRIVOXY_disable-dynamic-pcre),--disable-dynamic-pcre) \
	$(if $(CONFIG_PRIVOXY_disable-zlib),--disable-zlib) \
	\
	$(if $(CONFIG_PRIVOXY_disable-toggle),--disable-toggle) \
	$(if $(CONFIG_PRIVOXY_disable-force),--disable-force) \
	$(if $(CONFIG_PRIVOXY_disable-fast-redirects),--disable-fast-redirects) \
	$(if $(CONFIG_PRIVOXY_disable-stats),--disable-stats) \
	$(if $(CONFIG_PRIVOXY_enable-ie-images),--enable-ie-images) \
	$(if $(CONFIG_PRIVOXY_disable-image-blocking),--disable-image-blocking) \
	$(if $(CONFIG_PRIVOXY_disable-acl-support),--disable-acl-support) \
	$(if $(CONFIG_PRIVOXY_disable-trust-files),--disable-trust-files) \
	$(if $(CONFIG_PRIVOXY_disable-editor),--disable-editor) \
	$(if $(CONFIG_PRIVOXY_enable-no-gifs),--enable-no-gifs) \
	$(if $(CONFIG_PRIVOXY_enable-graceful-termination),--enable-graceful-termination) \
	$(if $(CONFIG_PRIVOXY_enable-extended-host-patterns),--enable-extended-host-patterns) \
	$(if $(CONFIG_PRIVOXY_enable-external-filters),--enable-external-filters) \
	$(if $(CONFIG_PRIVOXY_enable-accept-filter),--enable-accept-filter) \
	$(if $(CONFIG_PRIVOXY_enable-strptime-sanity-checks),--enable-strptime-sanity-checks) \
	$(if $(CONFIG_PRIVOXY_enable-compression),--enable-compression)

# needed otherwise errors during compile
MAKE_FLAGS:=

define Package/$(PKG_NAME)/conffiles
/etc/config/privoxy
/etc/privoxy/user.action
/etc/privoxy/user.filter
/etc/privoxy/user.trust
endef

define Package/$(PKG_NAME)/preinst
	#!/bin/sh
	[ -n "$${IPKG_INSTROOT}" ] && exit 0	# if run within buildroot exit

	# stop service if PKG_UPGRADE
	[ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/privoxy stop >/dev/null 2>&1
		
	exit 0	# supress errors from stop command
endef

define Package/$(PKG_NAME)/install
	if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/trust ]; then \
		mv -f $(PKG_INSTALL_DIR)/etc/privoxy/trust $(PKG_INSTALL_DIR)/etc/privoxy/user.trust; \
	fi
	if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/config ]; then \
		rm -f $(PKG_INSTALL_DIR)/etc/privoxy/config; \
	fi

	$(INSTALL_DIR) \
		$(1)/usr/sbin\
		$(1)/etc/privoxy/templates
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
	find $(PKG_INSTALL_DIR)/etc/privoxy/templates -maxdepth 1 -type f \
		-exec $(INSTALL_DATA) -t $(1)/etc/privoxy/templates {} \;
	find $(PKG_INSTALL_DIR)/etc/privoxy -maxdepth 1 -type f \
		-exec install -m0664 -t $(1)/etc/privoxy {} \;

	$(INSTALL_DIR) \
		$(1)/lib/upgrade/keep.d \
		$(1)/etc/init.d \
		$(1)/etc/hotplug.d/iface \
		$(1)/etc/config
	$(INSTALL_DATA) ./files/privoxy.upgrade $(1)/lib/upgrade/keep.d/privoxy
	$(INSTALL_BIN)  ./files/privoxy.init $(1)/etc/init.d/privoxy
	$(INSTALL_BIN)  ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
	$(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
endef

define Package/$(PKG_NAME)/postinst
	#!/bin/sh
	grep -i privoxy $${IPKG_INSTROOT}/etc/services >/dev/null 2>&1 || \
		echo -e "privoxy\t8118" >> $${IPKG_INSTROOT}/etc/services
endef

$(eval $(call BuildPackage,$(PKG_NAME)))