Patchwork [3/6] ttcp: convert to generic-package infrastructure

login
register
mail settings
Submitter Samuel Martin
Date Sept. 21, 2012, 10:28 p.m.
Message ID <1348266518-27665-4-git-send-email-s.martin49@gmail.com>
Download mbox | patch
Permalink /patch/185966/
State Accepted
Headers show

Comments

Samuel Martin - Sept. 21, 2012, 10:28 p.m.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Peter Korsgaard - Oct. 8, 2012, 9:09 p.m.
>>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes:

 Samuel> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
 Samuel> diff --git a/package/ttcp/ttcp.mk b/package/ttcp/ttcp.mk
 Samuel> index 080286b..894b0cb 100644
 Samuel> --- a/package/ttcp/ttcp.mk
 Samuel> +++ b/package/ttcp/ttcp.mk
 Samuel> @@ -4,47 +4,25 @@
 Samuel>  #
 Samuel>  #############################################################
 Samuel>  #
 Samuel> -TTCP_VERSION:=
 Samuel> -TTCP_SOURCE_URL=http://ftp.sunet.se/pub/network/monitoring/ttcp
 Samuel> -TTCP_SOURCE=ttcp$(TTCP_VERSION).c
 Samuel> -TTCP_DIR=$(BUILD_DIR)/ttcp$(TTCP_VERSION)
 Samuel> +TTCP_VERSION =
 Samuel> +TTCP_SITE    = http://ftp.sunet.se/pub/network/monitoring/ttcp
 Samuel> +TTCP_SOURCE  = ttcp.c
 Samuel> +TTCP_LICENSE = public domain
 
 Samuel> -$(DL_DIR)/$(TTCP_SOURCE):
 Samuel> -	 $(call DOWNLOAD,$(TTCP_SOURCE_URL)/$(TTCP_SOURCE))
 Samuel> +TTCP_BINARY  = ttcp
 
 Samuel> -$(TTCP_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE)
 Samuel> -	-mkdir $(TTCP_DIR)
 Samuel> -	cp -af $(DL_DIR)/$(TTCP_SOURCE) $(TTCP_DIR)
 Samuel> -	support/scripts/apply-patches.sh $(TTCP_DIR) package/ttcp/ ttcp-\*.patch
 Samuel> -	touch $(TTCP_DIR)/.unpacked
 Samuel> +define TTCP_EXTRACT_CMDS
 Samuel> +	cp -f -t $(@D) $(DL_DIR)/$(TTCP_SOURCE)
 Samuel> +endef
 
 Samuel> -$(TTCP_DIR)/.configured: $(TTCP_DIR)/.unpacked
 Samuel> -	touch $(TTCP_DIR)/.configured
 Samuel> +define TTCP_BUILD_CMDS
 Samuel> +	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) \
 Samuel> +		-o $(TTCP_SRCDIR)/$(TTCP_BINARY) $(@D)/$(TTCP_SOURCE)

I prefer to use $(@D) both places for consistency.
 Samuel> +endef
 
 Samuel> -$(TTCP_DIR)/ttcp: $(TTCP_DIR)/.configured
 Samuel> -	$(TARGET_CC) -O2 -o $(TTCP_DIR)/ttcp $(TTCP_DIR)/$(TTCP_SOURCE)
 Samuel> +define TTCP_INSTALL_TARGET_CMDS
 Samuel> +	$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(@D)/$(TTCP_BINARY)
 Samuel> +	$(INSTALL) -D -m 0755 $(@D)/$(TTCP_BINARY) $(TARGET_DIR)/usr/bin
 Samuel> +endef

You shouldn't do the explicit strip.

You have to provide the destination file name when using install -D.

Committed with those fixes, thanks.

Patch

diff --git a/package/ttcp/ttcp.mk b/package/ttcp/ttcp.mk
index 080286b..894b0cb 100644
--- a/package/ttcp/ttcp.mk
+++ b/package/ttcp/ttcp.mk
@@ -4,47 +4,25 @@ 
 #
 #############################################################
 #
-TTCP_VERSION:=
-TTCP_SOURCE_URL=http://ftp.sunet.se/pub/network/monitoring/ttcp
-TTCP_SOURCE=ttcp$(TTCP_VERSION).c
-TTCP_DIR=$(BUILD_DIR)/ttcp$(TTCP_VERSION)
+TTCP_VERSION =
+TTCP_SITE    = http://ftp.sunet.se/pub/network/monitoring/ttcp
+TTCP_SOURCE  = ttcp.c
+TTCP_LICENSE = public domain
 
-$(DL_DIR)/$(TTCP_SOURCE):
-	 $(call DOWNLOAD,$(TTCP_SOURCE_URL)/$(TTCP_SOURCE))
+TTCP_BINARY  = ttcp
 
-$(TTCP_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE)
-	-mkdir $(TTCP_DIR)
-	cp -af $(DL_DIR)/$(TTCP_SOURCE) $(TTCP_DIR)
-	support/scripts/apply-patches.sh $(TTCP_DIR) package/ttcp/ ttcp-\*.patch
-	touch $(TTCP_DIR)/.unpacked
+define TTCP_EXTRACT_CMDS
+	cp -f -t $(@D) $(DL_DIR)/$(TTCP_SOURCE)
+endef
 
-$(TTCP_DIR)/.configured: $(TTCP_DIR)/.unpacked
-	touch $(TTCP_DIR)/.configured
+define TTCP_BUILD_CMDS
+	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) \
+		-o $(TTCP_SRCDIR)/$(TTCP_BINARY) $(@D)/$(TTCP_SOURCE)
+endef
 
-$(TTCP_DIR)/ttcp: $(TTCP_DIR)/.configured
-	$(TARGET_CC) -O2 -o $(TTCP_DIR)/ttcp $(TTCP_DIR)/$(TTCP_SOURCE)
+define TTCP_INSTALL_TARGET_CMDS
+	$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(@D)/$(TTCP_BINARY)
+	$(INSTALL) -D -m 0755 $(@D)/$(TTCP_BINARY) $(TARGET_DIR)/usr/bin
+endef
 
-$(TARGET_DIR)/usr/bin/ttcp: $(TTCP_DIR)/ttcp
-	cp -af $(TTCP_DIR)/ttcp $(TARGET_DIR)/usr/bin/
-
-ttcp-legal-info:
-	@$(call legal-warning-pkg,ttcp,legal-info not yet implemented)
-
-ttcp: $(TARGET_DIR)/usr/bin/ttcp
-
-ttcp-source: $(DL_DIR)/$(TTCP_SOURCE)
-
-ttcp-clean:
-	rm -f $(TTCP_DIR)/*.o $(TTCP_DIR)/ttcp
-
-ttcp-dirclean:
-	rm -rf $(TTCP_DIR)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_TTCP),y)
-TARGETS+=ttcp
-endif
+$(eval $(generic-package))