]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/strip
Updated htop to 0.8.1.
[ipfire-3.x.git] / lfs / strip
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 PKG_NAME = strip
28 PKG_VER = LFS
29
30 THISAPP = $(PKG_NAME)-$(PKG_VER)
31 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
32
33 WHAT = -mount -type f -not -path '.$(TOOLS_DIR)*' \
34 -not -path './tmp*' -not -path './usr/src*' -not -path './dev*' \
35 -not -path './proc*' -not -path './sys*' -not -name '*.h' \
36 -not -name '*.txt' -not -name '*.m4' -not -name '*.c' -not -name '*.pl' \
37 -not -name '*.py' -not -name '*.sh' -not -name '*.bash' \
38 -not -name '*.info' -not -name '*.gz' -not -name '*.bz2' \
39 -not -name '*.a' -not -name '*.la' -not -name '*.mo'
40
41 ###############################################################################
42 # Top-level Rules
43 ###############################################################################
44
45 install : $(OBJECT)
46
47 download :
48
49 ###############################################################################
50 # Installation Details
51 ###############################################################################
52
53 $(OBJECT) :
54
55 ifeq "$(STAGE)" "toolchain"
56 ## Strip debugging symbols
57 for f in $$(find $(TOOLS_DIR)/ -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
58 grep -v ' shared object,' | \
59 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do \
60 strip --strip-debug "$$f" || :; \
61 done
62
63 ## Strip unneeded symbols
64 for f in $$(find $(TOOLS_DIR)/ -type f -a -exec file {} \; | \
65 grep ' shared object,' | \
66 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do \
67 strip --strip-unneeded "$$f"; \
68 done
69
70 -rm -rf $(TOOLS_DIR)/{,share/}{info,man} \
71 $(TOOLS_DIR)/usr/{share,man,info} \
72 $(TOOLS_DIR)/share/locale/* \
73 $(TOOLS_DIR)/var
74 chown -R root:root $(LFS)$(TOOLS_DIR)
75 endif
76
77 ifeq "$(STAGE)" "packages"
78 ## If the pyc and pyo files are the same, we can hardlink them
79 for pyc in $$(find $(LFS)/usr/lib/python* -type f -name "*.pyc"); do \
80 pyo=$$(echo "$$pyc" | sed "s/.pyc$$/.pyo/"); \
81 if cmp -s "$$pyc" "$$pyo"; then \
82 ln -f "$$pyc" "$$pyo"; \
83 fi; \
84 done
85
86 ## Strip debugging symbols
87 cd $(LFS) && \
88 for f in $$($(TOOLS_DIR)/bin/find $(WHAT) -type f \
89 \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
90 grep -v ' shared object,' | \
91 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do \
92 $(TOOLS_DIR)/bin/strip --strip-debug "$$f" || :; \
93 done
94
95 ## Strip unneeded symbols
96 cd $(LFS) && \
97 for f in $$($(TOOLS_DIR)/bin/find $(WHAT) -a -exec file {} \; | \
98 grep ' shared object,' | \
99 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do \
100 $(TOOLS_DIR)/bin/strip --strip-unneeded "$$f"; \
101 done
102 endif