Files
bpfire/lfs/glibc

158 lines
5.3 KiB
Plaintext

###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = 2.12.2
PORTS_VER = 2.12.1
THISAPP = glibc-$(VER)
DL_FILE = $(THISAPP).tar.bz2
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
# Normal build or /tools build.
#
ifeq "$(ROOT)" ""
TARGET = $(DIR_INFO)/$(THISAPP)
EXTRA_CONFIG = \
--prefix=/usr \
--libexecdir=/usr/lib/glibc
EXTRA_MAKE =
EXTRA_INSTALL =
else
TARGET = $(DIR_INFO)/$(THISAPP)-tools
EXTRA_CONFIG = \
--prefix=/tools \
--with-binutils=/tools/bin \
--with-headers=/tools/include \
--without-gd
EXTRA_MAKE =
EXTRA_INSTALL =
endif
EXTRA_CONFIG += --build=$(BUILDTARGET)
# Enable some extra optimization for the glibc code.
export CFLAGS := $(subst -O2,-O3,$(CFLAGS))
ifeq "$(MACHINE_TYPE)" "arm"
# Disable hardware FP for ARM.
EXTRA_CONFIG += \
--without-fp
endif
# Add some general configuration flags
EXTRA_CONFIG += \
--disable-profile \
--enable-kernel=2.6.16 \
--enable-add-ons \
--without-selinux \
--enable-experimental-malloc \
--enable-bind-now
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 903fcfa547df2f453476800e0838fe52
# ARM needs glibc-ports
ifeq "$(MACHINE_TYPE)" "arm"
objects += glibc-ports-$(PORTS_VER).tar.bz2
glibc-ports-$(PORTS_VER).tar.bz2 = $(DL_FROM)/glibc-ports-$(PORTS_VER).tar.bz2
glibc-ports-$(PORTS_VER).tar.bz2_MD5 = cb01ab976180e98287cef5079e35359e
endif
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
###############################################################################
# Downloading, checking, md5sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_MD5,$(objects)) :
@$(MD5)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
@mkdir $(DIR_SRC)/glibc-build
ifeq "$(MACHINE_TYPE)" "arm"
cd $(DIR_APP) && tar jxf $(DIR_DL)/glibc-ports-$(PORTS_VER).tar.bz2
cd $(DIR_APP) && mv -v glibc-ports-$(PORTS_VER) ports
endif
ifeq "$(ROOT)" ""
# This locale causes a loop on bash login - exclude it
cd $(DIR_APP) && sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED
ifeq "$(MACHINE_TYPE)" "arm"
cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
scripts/test-installation.pl
else
cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
scripts/test-installation.pl
endif
endif
cd $(DIR_SRC)/glibc-build && CFLAGS="$(CFLAGS)" $(DIR_APP)/configure $(EXTRA_CONFIG)
ifeq "$(ROOT)" ""
touch /etc/ld.so.conf
cd $(DIR_SRC)/glibc-build && make $(MAKETUNING) $(EXTRA_MAKE)
cd $(DIR_SRC)/glibc-build && make $(EXTRA_INSTALL) install
else
-mkdir /tools/etc
touch /tools/etc/ld.so.conf
cd $(DIR_SRC)/glibc-build && make $(MAKETUNING) $(EXTRA_MAKE)
cd $(DIR_SRC)/glibc-build && make $(EXTRA_INSTALL) install
endif
# Creating the locales
ifeq "$(ROOT)" ""
mkdir -p /usr/lib/locale
cd $(DIR_SRC)/glibc-build && localedef -i en_US -f ISO-8859-1 en_US
cd $(DIR_SRC)/glibc-build && localedef -i en_US -f UTF-8 en_US.utf8
endif
@rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
@$(POSTBUILD)