]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/binutils
s/TARGET/OBJECT/g
[ipfire-3.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007, 2008 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 = binutils
28 VER = 2.19
29 PKG_VER = 0
30
31 THISAPP = $(PKG_NAME)-$(VER)
32 DL_FILE = $(THISAPP).tar.bz2
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34
35 ifeq "$(STAGE)" "toolchain"
36 TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
37 else
38 TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
39 endif
40
41 MAINTAINER =
42 GROUP = Development/Tools
43 EXTRA = no
44 DEBUG = no
45 DEPS =
46
47 URL = http://www.gnu.org/software/binutils/
48 LICENSE = GPLv2+
49 SHORT_DESC = The GNU Binutils are a collection of binary tools.
50
51 define LONG_DESC
52 The GNU Binary Utilities, or binutils, is a collection of programming \
53 tools for the manipulation of object code in various object file formats.
54 endef
55
56 ###############################################################################
57 # Top-level Rules
58 ###############################################################################
59
60 objects = $(DL_FILE) \
61 $(THISAPP)-ld_makefile.patch \
62 $(THISAPP)-pt_pax-1.patch \
63 $(THISAPP)-lazy-1.patch \
64 $(THISAPP)-asprintf_fix.patch
65
66 download: $(objects)
67
68 install: $(OBJECT)
69
70 package:
71 @$(DO_PACKAGE)
72
73 $(objects):
74 @$(LOAD)
75
76 ###############################################################################
77 # Installation Details
78 ###############################################################################
79
80 $(OBJECT): $(objects)
81 @$(PREBUILD)
82 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(EXTRACTOR) $(DIR_DL)/$(DL_FILE)
83 @rm -rf $(DIR_SRC)/binutils-build
84 -mkdir -v $(DIR_SRC)/binutils-build
85
86 # Add PT_PaX header marking support. These markings are using by the PaX
87 # kernel, and Pax-utils, to identify which programs need things like executable
88 # stack, etc. Without this patch the PaX kernel must use legacy mode, and this
89 # patch is greatly preferable:
90 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-pt_pax-1.patch
91
92 ifeq "$(STAGE)" "toolchain"
93 ifeq "$(PASS)" "1"
94 cd $(DIR_SRC)/binutils-build && \
95 CC="gcc -B/usr/bin/" \
96 ../$(THISAPP)/configure \
97 $(CONFIGURE_ARCH) \
98 --target=$(IFS_TARGET) \
99 --prefix=$(TOOLS_DIR) \
100 --disable-nls \
101 --disable-werror
102 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
103 cd $(DIR_SRC)/binutils-build && make install
104
105 for t in $$(ls $(TOOLS_DIR)/$(IFS_TARGET)/bin); do \
106 ln -sfv ../$(IFS_TARGET)/bin/$${t} $(TOOLS_DIR)/bin/$(IFS_TARGET)-$${t}; \
107 done
108 endif
109
110 ifeq "$(PASS)" "2"
111 # Binutils libiberty has the same identical bug GCC has:
112 cd $(DIR_APP) && patch -Np0 -i $(DIR_PATCHES)/$(THISAPP)-asprintf_fix.patch
113
114 cd $(DIR_SRC)/binutils-build && \
115 ../$(THISAPP)/configure \
116 $(CONFIGURE_ARCH) \
117 --target=$(IFS_TARGET) \
118 --prefix=$(TOOLS_DIR) \
119 --with-lib-path=$(TOOLS_DIR)/lib \
120 --disable-nls \
121 --disable-werror
122 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
123 cd $(DIR_SRC)/binutils-build && make install
124
125 cd $(DIR_SRC)/binutils-build && make -C ld clean
126 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/lib:/usr/lib
127 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
128 endif
129 endif
130
131 ifeq "$(STAGE)" "base"
132 cd $(DIR_APP) && patch -Np0 -i $(DIR_PATCHES)/$(THISAPP)-asprintf_fix.patch
133 cd $(DIR_SRC)/binutils-build && \
134 CC="gcc -specs=$$(dirname $$(gcc --print-libgcc-file-name))/myspecs -B/usr/lib/ -B/usr/bin/" \
135 ../$(THISAPP)/configure \
136 --prefix=/usr \
137 --enable-shared \
138 --disable-werror \
139 --disable-static
140 cd $(DIR_SRC)/binutils-build && make tooldir=/usr $(PARALLELISMFLAGS)
141 cd $(DIR_SRC)/binutils-build && make tooldir=/usr install
142
143 cp -fv ../$(THISAPP)/include/libiberty.h /usr/include
144 endif
145
146 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
147 @$(POSTBUILD)