Install cpuid.h to toolchain.
[ipfire-2.x.git] / lfs / glibc
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
d10cf0df 4# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
5# #
6# This program is free software: you can redistribute it and/or modify #
cd1a2927 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
cd1a2927
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
cd1a2927
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
cd1a2927 18# #
cd1a2927
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
ce346d23
MT
27VER = 2.12.2
28PORTS_VER = 2.12.1
cd1a2927 29
dd714b8a 30THISAPP = glibc-$(VER)
cd1a2927 31DL_FILE = $(THISAPP).tar.bz2
7a98bae5 32DL_FROM = $(URL_IPFIRE)
cd1a2927 33DIR_APP = $(DIR_SRC)/$(THISAPP)
cd1a2927
MT
34
35# Normal build or /tools build.
36#
37ifeq "$(ROOT)" ""
38 TARGET = $(DIR_INFO)/$(THISAPP)
39 EXTRA_CONFIG = --prefix=/usr \
1d2919b2 40 --disable-profile --enable-add-ons \
dd714b8a 41 --enable-kernel=2.6.0 --libexecdir=/usr/lib/glibc
cd1a2927
MT
42 EXTRA_MAKE =
43 EXTRA_INSTALL =
44else
45 TARGET = $(DIR_INFO)/$(THISAPP)-tools
46 EXTRA_CONFIG = --prefix=/tools \
1d2919b2 47 --disable-profile --enable-add-ons \
dd714b8a
MT
48 --enable-kernel=2.6.0 --with-binutils=/tools/bin \
49 --without-gd --with-headers=/tools/include \
50 --without-selinux
e22c7973
MT
51 EXTRA_MAKE =
52 EXTRA_INSTALL =
cd1a2927
MT
53endif
54
d10cf0df
AF
55EXTRA_CONFIG += --build=$(BUILDTARGET)
56
cc72d5cb 57ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
58 # Disable hardware FP for ARM.
59 EXTRA_CONFIG += \
1d2919b2 60 --without-fp
51f9e7ac
MT
61endif
62
cd1a2927
MT
63###############################################################################
64# Top-level Rules
65###############################################################################
66
ce346d23 67objects = $(DL_FILE)
cd1a2927
MT
68
69$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
70
ce346d23 71$(DL_FILE)_MD5 = 903fcfa547df2f453476800e0838fe52
51f9e7ac
MT
72
73# ARM needs glibc-ports
cc72d5cb 74ifeq "$(MACHINE_TYPE)" "arm"
ce346d23
MT
75 objects += glibc-ports-$(PORTS_VER).tar.bz2
76 glibc-ports-$(PORTS_VER).tar.bz2 = $(DL_FROM)/glibc-ports-$(PORTS_VER).tar.bz2
77 glibc-ports-$(PORTS_VER).tar.bz2_MD5 = cb01ab976180e98287cef5079e35359e
51f9e7ac 78endif
cd1a2927
MT
79
80install : $(TARGET)
81
82check : $(patsubst %,$(DIR_CHK)/%,$(objects))
83
84download :$(patsubst %,$(DIR_DL)/%,$(objects))
85
86md5 : $(subst %,%_MD5,$(objects))
87
88###############################################################################
89# Downloading, checking, md5sum
90###############################################################################
91
92$(patsubst %,$(DIR_CHK)/%,$(objects)) :
93 @$(CHECK)
94
95$(patsubst %,$(DIR_DL)/%,$(objects)) :
96 @$(LOAD)
97
98$(subst %,%_MD5,$(objects)) :
99 @$(MD5)
100
101###############################################################################
102# Installation Details
103###############################################################################
104
105$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
106 @$(PREBUILD)
107 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
cd1a2927 108 @mkdir $(DIR_SRC)/glibc-build
cc72d5cb 109ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
110 cd $(DIR_APP) && tar jxf $(DIR_DL)/glibc-ports-$(VER).tar.bz2
111 cd $(DIR_APP) && mv -v glibc-ports-$(VER) ports
112
113 cd $(DIR_APP)/ports && patch -Np1 -i $(DIR_SRC)/src/patches/glibc-ports-avoid-using-asm-procinfo.patch
114
115 # asm/page.h should not be included in sysdeps/unix/sysv/linux/arm/ioperm.c.
116 cd $(DIR_APP) && sed "/asm\/page.h/d" -i ports/sysdeps/unix/sysv/linux/arm/ioperm.c
51f9e7ac 117endif
82a8499a 118
9b0ff0a0 119ifeq "$(ROOT)" ""
dd714b8a
MT
120 # This locale causes a loop on bash login - exclude it
121 cd $(DIR_APP) && sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED
cc72d5cb 122ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
123 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
124 scripts/test-installation.pl
125else
dd714b8a
MT
126 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
127 scripts/test-installation.pl
9b0ff0a0 128endif
51f9e7ac
MT
129endif
130 cd $(DIR_SRC)/glibc-build && CFLAGS="$(CFLAGS)" $(DIR_APP)/configure $(EXTRA_CONFIG)
9b0ff0a0 131
cd1a2927
MT
132ifeq "$(ROOT)" ""
133 touch /etc/ld.so.conf
dd714b8a 134 cd $(DIR_SRC)/glibc-build && make $(MAKETUNING) $(EXTRA_MAKE)
cd1a2927
MT
135 cd $(DIR_SRC)/glibc-build && make $(EXTRA_INSTALL) install
136else
137 -mkdir /tools/etc
138 touch /tools/etc/ld.so.conf
dd714b8a
MT
139 cd $(DIR_SRC)/glibc-build && make $(MAKETUNING) $(EXTRA_MAKE)
140 cd $(DIR_SRC)/glibc-build && make $(EXTRA_INSTALL) install
cd1a2927
MT
141endif
142
143 # Creating the locales
144ifeq "$(ROOT)" ""
145 mkdir -p /usr/lib/locale
cd1a2927
MT
146 cd $(DIR_SRC)/glibc-build && localedef -i en_US -f ISO-8859-1 en_US
147 cd $(DIR_SRC)/glibc-build && localedef -i en_US -f UTF-8 en_US.utf8
cd1a2927 148endif
cd1a2927
MT
149 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
150 @$(POSTBUILD)