Hello,
I'm facing an interesting porting challenge : one of the program which
is to be installed on our target is compressed using upx. As you may
know, upx-compressed programs are not to be stripped (strip removes
everything but the stub, resulting in a 300 bytes program that does
nothing but crashing ; that's not very usefull).
The problem is here : OpenWRT's package-ipkg.mk automatically strip any
executables it finds right after Package/X/install. The relevant code
snippet is (from trunk/include/package-ipkg.mk [1], line 90 to 95):
$$(IPKG_$(1)): $(STAMP_BUILT)
@rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL
$(call Package/$(1)/install,$$(IDIR_$(1)))
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name
'.#*' | $(XARGS) rm -rf
$(RSTRIP) $$(IDIR_$(1))
To avoid this, I do something that I find quite bad (and I'm sure you'll
agree with me): I added a PKG_NO_STRIP variable in my package Makefile,
and I modified package-ipkg.mk :
Index: openwrt/include/package-ipkg.mk
===================================================================
--- openwrt/include/package-ipkg.mk (revision 3671)
+++ openwrt/include/package-ipkg.mk (working copy)
@@ -117,7 +117,7 @@
$(call Package/$(1)/install,$$(IDIR_$(1)))
mkdir -p $(PACKAGE_DIR)
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' |
$(XARGS) rm -rf
- $(RSTRIP) $$(IDIR_$(1))
+ [ ! -n "$$(PKG_NO_STRIP)" ] && $(RSTRIP) $$(IDIR_$(1))
ifneq ($$(KEEP_$(1)),)
@( \
(this is not the version present in the openwrt trunk, but you get the
trick).
I think this solution is sub-optimal - but then, I believe the whole
install process is suboptimal (from a versatility point of view). You
can change the behavior of all major build step - but you can only
select the files that are to be installed (using Package/X/install). It
would be nice to be able to allow a user to specify a different
stripping behavior (or no behavior at all). There are many cases where
such a possibility would be useful:
* if you don't want (some or all) your binaries to be stripped at all
* if you want to use different stripping parameters (for example strip
--only-keep-debug + objcopy --add-gnu-debuglink)
* if you want to use another software to "strip" the binaries (for
instance, upx).
It's now the time to write down a few questions :
+ Do you think that a configurable strip target (for example
Package/X/strip, which defaults to Package/strip/Default) makes sense ?
+ Do you have any other idea ?
Best regards,
-- Emmanuel Deloget
[1] https://dev.openwrt.org/browser/trunk/include/package-ipkg.mk#L75
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel