tor: package improvements
authorKonstantin Demin <redacted>
Sat, 17 Nov 2018 15:55:06 +0000 (18:55 +0300)
committertripolar <redacted>
Sat, 8 Dec 2018 10:55:41 +0000 (11:55 +0100)
* remove "torify" script
  - "torify" script is just a wrapper around torsocks,
    but torsocks is not currently present in packages.
* tor-geoip: fix "install" recipe:
  - use $(INSTALL_DATA) instead of $(CP) as a proper way
    of installing files
* drop deprecated configure option:
    "--with-ssl-dir" is considered deprecated and obsolete,
    while "--with-openssl-dir" is already present.
* build in parallel
* build with -ffunction-sections, -fdata-sections,
  --gc-sections and -flto
* remove "--disable-largefile" in CONFIGURE_ARGS
* remove "-std=gnu99" in EXTRA_CFLAGS
* use $(FPIC) in EXTRA_CFLAGS
* remove trailing whitespace

Compile- and run-tested on ar71xx/generic,
TP-Link Archer C7 v2 (world-wide version).

Signed-off-by: Konstantin Demin <redacted>
net/tor/Makefile

index 2702a18c7d448d43d310741a52728472eed8a6eb..a4f56f923e069a48dd6ad53135d2a2a32c2affab 100644 (file)
@@ -20,6 +20,8 @@ PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
 PKG_LICENSE_FILES:=LICENSE
 
 PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -68,7 +70,7 @@ endef
 
 define Package/tor-resolve/description
 $(call Package/tor/Default/description)
- Resolve a hostname to an IP address via tor 
+ Resolve a hostname to an IP address via tor
 endef
 
 define Package/tor-geoip
@@ -90,25 +92,24 @@ endef
 
 CONFIGURE_ARGS += \
        --with-libevent-dir="$(STAGING_DIR)/usr" \
-       --with-ssl-dir="$(STAGING_DIR)/usr" \
        --with-openssl-dir="$(STAGING_DIR)/usr" \
        --with-zlib-dir="$(STAGING_DIR)/usr" \
        --disable-asciidoc \
        --disable-seccomp \
        --disable-libscrypt \
        --disable-unittests \
-       --disable-largefile \
        --disable-lzma \
        --with-tor-user=tor \
        --with-tor-group=tor
 
-EXTRA_CFLAGS += -std=gnu99
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections -flto
 
 ifneq ($(CONFIG_SSP_SUPPORT),y)
        CONFIGURE_ARGS += \
                --disable-gcc-hardening
 else
-       EXTRA_CFLAGS += -fPIC
+       EXTRA_CFLAGS += $(FPIC)
 endif
 
 CONFIGURE_VARS += \
@@ -117,7 +118,6 @@ CONFIGURE_VARS += \
 define Package/tor/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/torify $(1)/usr/sbin/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
        $(INSTALL_DIR) $(1)/etc/tor
@@ -136,8 +136,10 @@ endef
 
 define Package/tor-geoip/install
        $(INSTALL_DIR) $(1)/usr/share/tor
-       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
-       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 $(1)/usr/share/tor/
+       $(INSTALL_DATA) \
+         $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
+         $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
+       $(1)/usr/share/tor/
 endef
 
 $(eval $(call BuildPackage,tor))
git clone https://git.99rst.org/PROJECT