Переглянути джерело

squid: initial import from old-packages

Signed-off-by: Luka Perkov <luka@openwrt.org>
Luka Perkov 10 роки тому
джерело
коміт
3df768771f

+ 132
- 0
net/squid/Makefile Переглянути файл

@@ -0,0 +1,132 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=squid
11
+PKG_VERSION:=3.4.10
12
+PKG_RELEASE:=1
13
+
14
+PKG_LICENSE:=GPL-2.0
15
+PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
16
+
17
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
18
+PKG_SOURCE_URL:=http://www.squid-cache.org/Versions/v3/3.4/
19
+PKG_MD5SUM:=3136edfe9bc2458e725671b0d2455702
20
+
21
+PKG_BUILD_PARALLEL:=1
22
+PKG_INSTALL:=1
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+define Package/squid/Default
27
+  SECTION:=net
28
+  CATEGORY:=Network
29
+  SUBMENU:=Web Servers/Proxies
30
+  URL:=http://www.squid-cache.org/
31
+endef
32
+
33
+define Package/squid
34
+  $(call Package/squid/Default)
35
+  MENU:=1
36
+  DEPENDS:=+libopenssl +libpthread +librt +libltdl +libstdcpp
37
+  TITLE:=full-featured Web proxy cache
38
+endef
39
+
40
+define Package/squid/description
41
+  Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more.
42
+  It reduces bandwidth and improves response times by caching and reusing
43
+  frequently-requested web pages.
44
+endef
45
+
46
+define Package/squid-mod-cachemgr
47
+  $(call Package/squid/Default)
48
+  DEPENDS:=squid
49
+  TITLE:=Web based proxy manager and reporting tool
50
+endef
51
+
52
+CONFIGURE_ARGS += \
53
+	--config-cache \
54
+	--datadir=/usr/share/squid \
55
+	--libexecdir=/usr/lib/squid \
56
+	--sysconfdir=/etc/squid \
57
+	--enable-shared \
58
+	--disable-static \
59
+	--enable-icmp \
60
+	--enable-delay-pools \
61
+	--enable-icap-client \
62
+	--enable-kill-parent-hack \
63
+	--disable-snmp \
64
+	--enable-ssl \
65
+	--enable-cache-digests \
66
+	--enable-auth \
67
+	--enable-auth-basic \
68
+	--enable-auth-ntlm \
69
+	--enable-auth-negotiate \
70
+	--enable-auth-digest \
71
+	--enable-linux-netfilter \
72
+	--disable-unlinkd \
73
+	--enable-x-accelerator-vary \
74
+	--disable-translation \
75
+	--disable-auto-locale \
76
+	--with-dl \
77
+	--with-pthreads \
78
+	--without-expat \
79
+	--without-libxml2 \
80
+	--without-nettle \
81
+	--with-openssl=$(STAGING_DIR)/usr \
82
+	--enable-epoll \
83
+	--with-maxfd=4096 \
84
+	--disable-external-acl-helpers \
85
+	--disable-auth-negotiate \
86
+	--disable-auth-ntlm \
87
+	--disable-auth-digest \
88
+	--disable-auth-basic \
89
+	--disable-arch-native \
90
+	--with-krb5-config=no \
91
+	--without-libcap
92
+
93
+CONFIGURE_VARS += \
94
+	ac_cv_header_linux_netfilter_ipv4_h=yes \
95
+	ac_cv_epoll_works=yes \
96
+
97
+define Build/Compile
98
+	$(MAKE) -C $(PKG_BUILD_DIR)/lib \
99
+		all
100
+	$(MAKE) -C $(PKG_BUILD_DIR) \
101
+		DESTDIR="$(PKG_INSTALL_DIR)" \
102
+		install
103
+endef
104
+
105
+define Package/squid/install
106
+	$(INSTALL_DIR) $(1)/usr/sbin
107
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/squid $(1)/usr/sbin/
108
+
109
+	$(INSTALL_DIR) $(1)/etc/config
110
+	$(INSTALL_CONF) ./files/squid.config $(1)/etc/config/squid
111
+
112
+	$(INSTALL_DIR) $(1)/etc/squid
113
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/squid/mime.conf $(1)/etc/squid/
114
+	$(INSTALL_CONF) ./files/squid.conf $(1)/etc/squid/
115
+
116
+	$(INSTALL_DIR) $(1)/etc/init.d/
117
+	$(INSTALL_BIN) ./files/squid.init $(1)/etc/init.d/squid
118
+
119
+	$(INSTALL_DIR) $(1)/usr/share/squid/icons/
120
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/squid/icons/* $(1)/usr/share/squid/icons/
121
+
122
+	$(INSTALL_DIR) $(1)/usr/share/squid/errors/templates/
123
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/squid/errors/templates/* $(1)/usr/share/squid/errors/templates/
124
+endef
125
+
126
+define Package/squid-mod-cachemgr/install
127
+	$(INSTALL_DIR) $(1)/www/cgi-bin/
128
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/squid/cachemgr.cgi $(1)/www/cgi-bin/
129
+endef
130
+
131
+$(eval $(call BuildPackage,squid))
132
+$(eval $(call BuildPackage,squid-mod-cachemgr))

+ 44
- 0
net/squid/files/squid.conf Переглянути файл

@@ -0,0 +1,44 @@
1
+acl localnet src 10.0.0.0/8
2
+acl localnet src 172.16.0.0/12
3
+acl localnet src 192.168.0.0/16
4
+acl localnet src fc00::/7
5
+acl localnet src fe80::/10
6
+
7
+acl ssl_ports port 443
8
+
9
+acl safe_ports port 80
10
+acl safe_ports port 21
11
+acl safe_ports port 443
12
+acl safe_ports port 70
13
+acl safe_ports port 210
14
+acl safe_ports port 1025-65535
15
+acl safe_ports port 280
16
+acl safe_ports port 488
17
+acl safe_ports port 591
18
+acl safe_ports port 777
19
+acl connect method connect
20
+
21
+http_access deny !safe_ports
22
+http_access deny connect !ssl_ports
23
+
24
+http_access allow localhost manager
25
+http_access deny manager
26
+
27
+http_access deny to_localhost
28
+
29
+http_access allow localnet
30
+http_access allow localhost
31
+
32
+http_access deny all
33
+
34
+refresh_pattern ^ftp: 1440 20% 10080
35
+refresh_pattern ^gopher: 1440 0% 1440
36
+refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
37
+refresh_pattern . 0 20% 4320
38
+
39
+access_log none
40
+cache_log /dev/null
41
+cache_store_log /dev/null
42
+logfile_rotate 0
43
+
44
+logfile_daemon /dev/null

+ 5
- 0
net/squid/files/squid.config Переглянути файл

@@ -0,0 +1,5 @@
1
+config squid 'squid'
2
+	option config_file '/etc/squid/squid.conf'
3
+	option http_port '3128'
4
+	option coredump_dir '/tmp/squid'
5
+	option visible_hostname 'OpenWrt'

+ 52
- 0
net/squid/files/squid.init Переглянути файл

@@ -0,0 +1,52 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2015 OpenWrt.org
3
+
4
+START=90
5
+STOP=10
6
+
7
+USE_PROCD=1
8
+PROG=/usr/sbin/squid
9
+CONFIGFILE="/tmp/squid/squid.conf"
10
+
11
+validate_squid_section() {
12
+	uci_validate_section squid squid "${1}" \
13
+		'config_file:string' \
14
+		'http_port:port:3128' \
15
+		'coredump_dir:string' \
16
+		'visible_hostname:string:OpenWrt' \
17
+		'pinger_enable:string:off'
18
+}
19
+
20
+start_service() {
21
+	local config_file http_port coredump_dir visible_hostname pinger_enable
22
+
23
+	validate_squid_section squid || {
24
+		echo "validation failed"
25
+		return 1
26
+	}
27
+
28
+	mkdir -p $(dirname $CONFIGFILE)
29
+
30
+	cat $config_file > $CONFIGFILE
31
+	echo http_port $http_port >> $CONFIGFILE
32
+	echo coredump_dir $coredump_dir >> $CONFIGFILE
33
+	echo visible_hostname $visible_hostname >> $CONFIGFILE
34
+	echo pinger_enable $pinger_enable >> $CONFIGFILE
35
+
36
+	procd_open_instance
37
+	procd_set_param command $PROG -s -f $CONFIGFILE -N
38
+	procd_set_param file $CONFIGFILE
39
+	procd_set_param respawn
40
+	procd_close_instance
41
+}
42
+
43
+stop_service()
44
+{
45
+        ${PROG} -f $CONFIGFILE -N -k shutdown 2>/dev/null
46
+}
47
+
48
+service_triggers()
49
+{
50
+	procd_add_reload_trigger "squid"
51
+	procd_add_validation validate_squid_section
52
+}

+ 49
- 0
net/squid/patches/001-cross_compile.patch Переглянути файл

@@ -0,0 +1,49 @@
1
+--- a/src/Makefile.in
2
++++ b/src/Makefile.in
3
+@@ -7742,7 +7742,7 @@ cache_cf.o: cf_parser.cci
4
+ 
5
+ # cf_gen builds the configuration files.
6
+ cf_gen$(EXEEXT): $(cf_gen_SOURCES) $(cf_gen_DEPENDENCIES) cf_gen_defines.cci
7
+-	$(HOSTCXX) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
8
++	g++ -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
9
+ 
10
+ # squid.conf.default is built by cf_gen when making cf_parser.cci
11
+ squid.conf.default squid.conf.documented: cf_parser.cci
12
+--- a/configure
13
++++ b/configure
14
+@@ -22223,7 +22223,7 @@ $as_echo_n "checking whether the SSL_get
15
+   if test "$cross_compiling" = yes; then :
16
+   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
17
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
18
+-as_fn_error $? "cannot run test program while cross compiling
19
++_as_fn_error $? "cannot run test program while cross compiling
20
+ See \`config.log' for more details" "$LINENO" 5; }
21
+ else
22
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
23
+@@ -22271,7 +22271,7 @@ $as_echo_n "checking whether the workaro
24
+   if test "$cross_compiling" = yes; then :
25
+   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
26
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
27
+-as_fn_error $? "cannot run test program while cross compiling
28
++_as_fn_error $? "cannot run test program while cross compiling
29
+ See \`config.log' for more details" "$LINENO" 5; }
30
+ else
31
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
32
+@@ -24921,7 +24921,7 @@ else
33
+     if test "$cross_compiling" = yes; then :
34
+   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
35
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
36
+-as_fn_error $? "cannot run test program while cross compiling
37
++_as_fn_error $? "cannot run test program while cross compiling
38
+ See \`config.log' for more details" "$LINENO" 5; }
39
+ else
40
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
41
+@@ -24946,7 +24946,7 @@ else
42
+     if test "$cross_compiling" = yes; then :
43
+   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
44
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
45
+-as_fn_error $? "cannot run test program while cross compiling
46
++_as_fn_error $? "cannot run test program while cross compiling
47
+ See \`config.log' for more details" "$LINENO" 5; }
48
+ else
49
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext

+ 29
- 0
net/squid/patches/100-mime.patch Переглянути файл

@@ -0,0 +1,29 @@
1
+--- a/src/mime.conf.default
2
++++ b/src/mime.conf.default
3
+@@ -1,19 +1,3 @@
4
+-# This file associates filename extensions (for servers or services
5
+-# that don't automatically include them - like ftp) with a mime type
6
+-# and a graphical icon.
7
+-#
8
+-#
9
+-# This file has the format :
10
+-# regex content-type icon content-encoding transfer-mode
11
+-#-----------------------------------------------------------------------------------
12
+-#
13
+-#
14
+-# Content-Encodings are taken from section 3.1 of RFC2068 (HTTP/1.1)
15
+-#
16
+-#
17
+-#
18
+-# regexp	content-type			icon				encoding mode	actions
19
+-#--------------------------------------------------------------------------------------------------------
20
+ \.gif$			image/gif		silk/image.png			-	image	+download
21
+ \.mime$			www/mime		silk/page_white_text.png	-	ascii	+download
22
+ ^internal-dirup$	-			silk/arrow_up.png		-	-
23
+@@ -190,6 +174,4 @@
24
+ \.xml$		text/xml			silk/page_world.png		-	ascii	+download
25
+ \.xsl$		text/xml			silk/layout.png			-	ascii	+download
26
+ \.xyz$		chemical/x-xyz			silk/chart_line.png		-	image	+download
27
+-
28
+-# the default
29
+ .		text/plain			silk/bullet_red.png		-	image	+download +view