説明なし

Makefile 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=privoxy
  9. PKG_VERSION:=3.0.22
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-stable-src.tar.gz
  12. PKG_SOURCE_URL:=@SF/ijbswa
  13. PKG_MD5SUM:=aa121751d332a51d37d3c6e4b7594daa
  14. PKG_LICENSE:=GPL-2.0
  15. PKG_LICENSE_FILES:=LICENSE
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-stable
  17. PKG_FIXUP:=autoreconf
  18. PKG_INSTALL:=1
  19. PKG_MAINTAINER:=christian.schoenebeck@gmail.com
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/privoxy
  22. SECTION:=net
  23. CATEGORY:=Network
  24. SUBMENU:=Web Servers/Proxies
  25. DEPENDS:=+libpcre +libpthread +zlib
  26. TITLE:=web proxy with advanced filtering capabilities
  27. URL:=http://www.privoxy.org/
  28. USERID:=privoxy=8118:privoxy=8118
  29. endef
  30. define Package/privoxy/description
  31. Privoxy is a web proxy with advanced filtering capabilities for
  32. protecting privacy, modifying web page content, managing cookies,
  33. controlling access, and removing ads, banners, pop-ups and other
  34. obnoxious Internet junk. Privoxy has a very flexible configuration
  35. and can be customized to suit individual needs and tastes. Privoxy
  36. has application for both stand-alone systems and multi-user networks.
  37. Version: $(PKG_VERSION)-$(PKG_RELEASE)
  38. endef
  39. CONFIGURE_ARGS += \
  40. --sysconfdir=/etc/privoxy \
  41. # needed otherwise errors during compile
  42. MAKE_FLAGS:=
  43. define Build/Install
  44. $(call Build/Install/Default,)
  45. # rename original sample config from pkg_source to save existing one during install
  46. mv $(PKG_INSTALL_DIR)/etc/privoxy/config $(PKG_INSTALL_DIR)/etc/privoxy/config.privoxy
  47. endef
  48. define Package/privoxy/conffiles
  49. /etc/config/privoxy
  50. /etc/privoxy/config # temporary needed if updating from old version
  51. endef
  52. define Package/privoxy/preinst
  53. #!/bin/sh
  54. # if run within buildroot exit
  55. [ -n "$${IPKG_INSTROOT}" ] && exit 0
  56. # stop service # if PKG_UPGRADE NOT WORKING
  57. # [ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/privoxy stop
  58. /etc/init.d/privoxy stop >/dev/null 2>&1
  59. exit 0 # supress errors from stop command
  60. endef
  61. define Package/privoxy/install
  62. $(INSTALL_DIR) $(1)/usr/sbin
  63. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
  64. $(INSTALL_DIR) $(1)/etc/init.d
  65. $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
  66. # no longer needed because running with procd
  67. # $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  68. # $(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
  69. $(INSTALL_DIR) $(1)/etc/privoxy
  70. $(CP) $(PKG_INSTALL_DIR)/etc/privoxy/* $(1)/etc/privoxy/
  71. # temporary needed if updating from old version
  72. # otherwise old config file will be delete by opkg
  73. $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config
  74. # create .old file to be removed with next pacakge builds during update
  75. $(INSTALL_CONF) ./files/privoxy.oldconfig $(1)/etc/privoxy/config.old
  76. $(INSTALL_DIR) $(1)/etc/config
  77. $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
  78. endef
  79. define Package/privoxy/postinst
  80. #!/bin/sh
  81. # if fresh install we don't need old config file in privoxy directory
  82. [ "$${PKG_UPGRADE}" = "0" ] && rm -f /etc/privoxy/config
  83. # if run within buildroot exit here
  84. [ -n "$${IPKG_INSTROOT}" ] && exit 0
  85. # if PKG_UPGRADE then build uci configuration
  86. # from existing(?) old /etc/privoxy/config file
  87. if [ "$${PKG_UPGRADE}" = "1" -a -f /etc/privoxy/config ]; then
  88. echo "converting OLD config to NEW uci configuration"
  89. SECTION="privoxy.privoxy"
  90. CFGFILE=/etc/privoxy/config
  91. echo -n > /etc/config/privoxy # clear/create uci configuration file
  92. cp -f $${CFGFILE} $${CFGFILE}.old # save old configuration
  93. # cleanup
  94. sed -i 's/^[ \t]*//;s/[ \t]*$$//' $${CFGFILE} # remove invisible chars at beginning and end of lines
  95. sed -i '/^#/d' $${CFGFILE} # remove lines with "#"
  96. sed -i '/^$$/d' $${CFGFILE} # remove empty lines
  97. uci -q set $${SECTION}="privoxy" # create section
  98. cat $${CFGFILE} | while read LINE; do
  99. # option is first parameter; uci did not like "-" in option names
  100. OPT=$$(echo $${LINE} | awk '{print $$1}' | sed 's/-/_/g')
  101. VAL=$$(echo $${LINE} | awk '{print $$2}')
  102. case $${OPT} in
  103. # debug 1024 => debug_1024 '1'
  104. debug)
  105. uci -q set $${SECTION}.debug_$${VAL}="1"
  106. ;;
  107. # handle list values; splitted case for better reading
  108. actionsfile|filterfile|listen_address)
  109. uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
  110. ;;
  111. permit_access|deny_access)
  112. uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
  113. ;;
  114. trust_info_url|forward)
  115. uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
  116. ;;
  117. forward_socks4|forward_socks4a)
  118. uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
  119. ;;
  120. forward_socks5|forward_socks5t)
  121. uci -q add_list $${SECTION}.$${OPT}="$${VAL}"
  122. ;;
  123. # all others are normal options
  124. *)
  125. uci -q set $${SECTION}.$${OPT}="$${VAL}"
  126. ;;
  127. esac
  128. done
  129. uci -q commit privoxy # commit changes
  130. rm -f $${CFGFILE} # remove old configuration file
  131. fi
  132. # set permissions to privoxy group
  133. echo "setting permissions"
  134. chgrp -R privoxy /etc/privoxy/*
  135. chmod 664 /etc/privoxy/*
  136. chmod 755 /etc/privoxy/templates
  137. chmod 644 /etc/privoxy/templates/*
  138. endef
  139. $(eval $(call BuildPackage,privoxy))