Changeset 20583


Ignore:
Timestamp:
2010-03-29T16:58:36+02:00 (8 years ago)
Author:
acinonyx
Message:

[packages] wget: Fix installation and cleanup package makefile (#6990)

  • wget package binary installed at /usr/bin/wget-ssl
  • wget-nossl package binary installed at /usr/bin/wget-nossl
  • allows both packages to co-exist without conflict
  • busybox symlink is replaced with symlink to newest package binary
  • symlink is restored when removing package with the following preference:
    1. /usr/bin/wget-ssl or /usr/bin/wget-nossl
    2. /bin/busybox
File:
1 edited

Legend:

Unmodified
Added
Removed
  • packages/net/wget/Makefile

    r18511 r20583  
    11# 
    2 # Copyright (C) 2007-2008 OpenWrt.org 
     2# Copyright (C) 2007-2010 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    1010PKG_NAME:=wget 
    1111PKG_VERSION:=1.12 
    12 PKG_RELEASE:=1 
     12PKG_RELEASE:=2 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 
    1515PKG_SOURCE_URL:=@GNU/$(PKG_NAME) 
    1616PKG_MD5SUM:=308a5476fc096a8a525d07279a6f6aa3 
     17 
     18PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) 
    1719 
    1820include $(INCLUDE_DIR)/package.mk 
     
    3840  DEPENDS+= +libopenssl 
    3941  TITLE+= (with SSL support) 
     42  VARIANT:=ssl 
    4043endef 
    4144 
     
    4851$(call Package/wget/Default) 
    4952  TITLE+= (without SSL support) 
     53  VARIANT:=nossl 
    5054endef 
    5155 
     
    5559endef 
    5660 
     61CONFIGURE_ARGS+= \ 
     62        --disable-rpath 
    5763 
    58 define Build/Template 
     64ifeq ($(BUILD_VARIANT),ssl) 
     65        CONFIGURE_ARGS+= \ 
     66                --with-ssl \ 
     67                --with-libssl-prefix="$(STAGING_DIR)/usr" 
     68endif 
    5969 
    60 $(STAMP_BUILT)-$(2): $(STAMP_PREPARED) 
    61         -$(MAKE) -C $(PKG_BUILD_DIR) clean 
    62         $(call Build/Configure/Default,$(3)) 
    63         $(MAKE) -C $(PKG_BUILD_DIR) 
    64         ( cd $(PKG_BUILD_DIR)/src; mv -f wget wget-$(2) ) 
    65         touch $$@ 
     70ifeq ($(BUILD_VARIANT),nossl) 
     71        CONFIGURE_ARGS+= \ 
     72                --without-ssl 
     73endif 
    6674 
    67 $(STAMP_BUILT): $(STAMP_BUILT)-$(2) 
    68  
    69 define Package/$(1)/install 
    70         $(INSTALL_DIR) $$(1)/usr/bin 
    71         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget-$(2) $$(1)/usr/bin/wget 
     75define Package/wget/install 
     76        $(INSTALL_DIR) $(1)/usr/bin 
     77        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-ssl 
    7278endef 
    7379 
    74 # FIXME: check if busybox really provides a wget applet 
    75 define Package/$(1)/postrm 
    76 #!/bin/sh 
    77 ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget 
     80define Package/wget-nossl/install 
     81        $(INSTALL_DIR) $(1)/usr/bin 
     82        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-nossl 
    7883endef 
    7984 
     85define Package/wget/postinst 
     86#!/bin/sh 
     87if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then 
     88  rm -rf $${IPKG_INSTROOT}/usr/bin/wget; 
     89fi 
     90ln -sf ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget 
    8091endef 
    8192 
    82 CONFIGURE_ARGS += \ 
    83         --disable-rpath 
     93define Package/wget/postrm 
     94#!/bin/sh 
     95rm $${IPKG_INSTROOT}/usr/bin/wget 
     96[ -x $${IPKG_INSTROOT}/usr/bin/wget-nossl ] && ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget || { 
     97  ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget 
     98  $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget 
     99} 
     100exit 0 
     101endef 
    84102 
    85 ifneq ($(SDK)$(CONFIG_PACKAGE_wget),) 
    86   define Build/with-ssl 
    87         $(call Build/Template,wget,with-ssl, \ 
    88                 --with-ssl \ 
    89                 --with-libssl-prefix="$(STAGING_DIR)/usr" \ 
    90         ) 
    91   endef 
    92 endif 
    93 $(eval $(Build/with-ssl)) 
     103define Package/wget-nossl/postinst 
     104#!/bin/sh 
     105if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then 
     106  rm -rf $${IPKG_INSTROOT}/usr/bin/wget; 
     107fi 
     108ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget 
     109endef 
    94110 
    95 ifneq ($(SDK)$(CONFIG_PACKAGE_wget-nossl),) 
    96   define Build/without-ssl 
    97         $(call Build/Template,wget-nossl,without-ssl, \ 
    98                 --without-ssl \ 
    99         ) 
    100   endef 
    101 endif 
    102 $(eval $(Build/without-ssl)) 
     111define Package/wget-nossl/postrm 
     112#!/bin/sh 
     113rm $${IPKG_INSTROOT}/usr/bin/wget 
     114[ -x $${IPKG_INSTROOT}/usr/bin/wget-ssl ] && ln -s ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget || { 
     115  ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget 
     116  $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget 
     117} 
     118exit 0 
     119endef 
    103120 
    104121$(eval $(call BuildPackage,wget)) 
Note: See TracChangeset for help on using the changeset viewer.