]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/test-toolchain
Converted some more scripts to new LFS format.
[ipfire-3.x.git] / lfs / test-toolchain
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007, 2008, 2009 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 = test-toolchain
28 VER =
29 PKG_VER = -1
30
31 THISAPP = $(PKG_NAME)
32
33 ifeq "$(STAGE)" "toolchain"
34 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
35 else
36 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
37 endif
38
39 MAINTAINER =
40 GROUP =
41 EXTRA = no
42 DEBUG = no
43 DEPS =
44
45 URL =
46 LICENSE =
47 SHORT_DESC = This script does some sanity checks on the toolchain.
48
49 define LONG_DESC
50 This script does some sanity checks on the toolchain.
51 endef
52
53 ###############################################################################
54 # Top-level Rules
55 ###############################################################################
56
57 objects =
58
59 download: $(objects)
60
61 info:
62 $(DO_PKG_INFO)
63
64 install: $(OBJECT)
65
66 package:
67 @$(DO_PACKAGE)
68
69 $(objects):
70 @$(LOAD)
71
72 ###############################################################################
73 # Installation Details
74 ###############################################################################
75
76 $(OBJECT): $(objects)
77 @$(PREBUILD)
78
79 ifeq "$(STAGE)" "toolchain"
80 ifeq "$(PASS)" "1"
81 cd $(DIR_TMP) && \
82 echo 'main(){}' | $(IFS_TARGET)-gcc -B $(TOOLS_DIR)/lib/ -x c - -lrt
83 cd $(DIR_TMP) && readelf -l a.out | grep ": $(TOOLS_DIR)"
84 endif
85
86 ifeq "$(PASS)" "2"
87 # Sanity check - ensure host not being searched for libs
88 cd $(DIR_TMP) && \
89 echo 'main(){}' | cc -x c -lbogus -v -Wl,--verbose - &> foo || :
90 cd $(DIR_TMP) && if grep "^attempt to open /usr" foo; then \
91 echo Oops; exit 1; \
92 fi
93 endif
94 endif
95
96 ifeq "$(STAGE)" "base"
97 # Sanity checks.
98 cd $(DIR_TMP) && \
99 echo 'main(){}' | cc -x c -specs=$$(dirname $$(gcc --print-libgcc-file-name))/myspecs \
100 -B/usr/lib/ -B/usr/bin/ -Wl,--verbose - -lrt &> foo
101 # 1. dynamic linker
102 cd $(DIR_TMP) && readelf -l a.out | grep ": /lib"
103
104 # 2. start files
105 cd $(DIR_TMP) && grep " /usr/lib/Scrt1.o succ" foo
106
107 # 3. libc
108 cd $(DIR_TMP) && grep " /lib.*libc.so.6 succ" foo
109
110 # 4. deps found from DT_NEEDED
111 cd $(DIR_TMP) && grep "^found.*at /lib.*/libpth" foo
112 endif
113
114 @$(POSTBUILD)