blob: 29450c309bfc2bca8ac31f69fd78a9b9d57e9c82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/hardened-glibc/hardened-glibc-2.6.1-r1.ebuild,v 1.2 2008/04/27 23:31:14 pappy Exp $
inherit eutils
# the main installation routine and patches
# from http://www.linuxfromscratch.org/hlfs
# and one file of patches of sys-libs/glibc
DESCRIPTION="Gentoo Hardened GNU libc6"
HOMEPAGE="http://www.gentoo.org/proj/en/hardened/"
KERNELVER="2.6.18"
GNU_MIRROR="ftp://ftp.gnu.org/gnu"
PATCHDIST="http://dev.gentoo.org/~pappy/dist/hardened"
PATCHPATH="sys-libs/hardened-glibc/files/2.6.1"
GENTOOPATCHES="glibc-2.6.1-GENTOOPATCHES.patch.gz"
SRC_URI="${SRC_URI} \
${GNU_MIRROR}/glibc/glibc-2.6.1.tar.bz2"
SRC_URI="${SRC_URI} \
${PATCHDIST}/${PATCHPATH}/${GENTOOPATCHES}"
LICENSE="LGPL-2"
SLOT="1"
# only works for x86 so far
KEYWORDS="~x86"
IUSE=""
PROVIDE="virtual/libc"
RESTRICT="strip" #46186
DEPEND=">=sys-devel/binutils-2.15.94
>=sys-devel/gcc-config-1.3.12
>=app-misc/pax-utils-0.1.10
virtual/os-headers
sys-devel/gettext
>=sys-apps/portage-2.1.2"
RDEPEND="sys-devel/gettext"
pkg_setup() {
# hardcoding the CHOST in this ebuild (for x86 stages)
export CHOST="i486-pc-linux-gnu"
# CFLAGS+="-march=i686" for undefined reference to
# `__sync_bool_compare_and_swap_4'
export CFLAGS="-O2 -pipe -march=i686"
export CXXFLAGS="${CFLAGS}"
export CPPFLAGS=""
export ASFLAGS=""
export LDFLAGS=""
if [[ "x${MAKEOPTS}y" == "xy" ]]
then
export MAKEOPTS="-j4"
fi
einfo "using CHOST:${CHOST}"
einfo "using C(XX)FLAGS:${CFLAGS}:${CXXFLAGS}"
einfo "using MAKEOPTS:${MAKEOPTS}"
}
src_compile() {
cd "${WORKDIR}/glibc-${PV}"
epatch "${WORKDIR}/glibc-2.6.1-GENTOOPATCHES.patch"
mkdir -p "${WORKDIR}/glibc-build"
cd "${WORKDIR}/glibc-build"
"${WORKDIR}/glibc-${PV}/configure" \
--target="${CHOST}" \
--prefix=/usr \
--enable-bind-now \
--without-gd \
--disable-profile \
--enable-add-ons=nptl \
--without-selinux \
--with-tls \
--with-__thread \
--enable-kernel="${KERNELVER}" \
--without-cvs || die "configuration failed"
make || die "compile failed"
}
src_install() {
cd "${WORKDIR}/glibc-build"
make install_root="${D}" install || die "make install failed"
# NOTE: for installing all glibc locales in the binpackage,
# NOTE: make install_root="${D}" localedata/install-locales
insinto /etc
local configfiles="${WORKDIR}/glibc-${PV}/gentoo"
# install the locale-gen helper utility and config file
dosbin "${configfiles}/locale/locale-gen" || \
die "locale-gen helper script could not be installed"
doins "${configfiles}/locale/locale.gen" || \
die "locale.gen config file could not be installed"
# install the nscd startup script
doinitd "${configfiles}/etc/nscd" || \
die "nscd run level startup script could not be installed"
# install the config files for glibc
doins "${configfiles}"/etc/*.conf || \
die "glibc config files could not be installed"
# make sure the localtime is not overwritten by glibc emerges
rm "${D}/etc/localtime"
}
# NOTE: the locales are not in the .tbz2 file of the binpackage
# NOTE: but will be generated in the postinst routine from here
pkg_postinst() {
# make sure the file exists on the installed system
touch "${ROOT}/ld.so.conf"
# install locales (logic taken from sys-libs/glibc)
local locale_list="${ROOT}/etc/locale.gen"
if [[ -z $(locale-gen --list --config "${locale_list}") ]]
then
locale_list="${ROOT}/usr/share/i18n/SUPPORTED"
fi
# find the number of jobs available
local x jobs
for x in ${MAKEOPTS} ; do [[ "${x}" == -j* ]] && jobs=${x#-j} ; done
# generate the locales
locale-gen -j ${jobs:-2} --config "${locale_list}"
# set the timezone automatically if not found
if [[ ! -f "${ROOT}/etc/localtime" ]]
then
einfo "timezone not found: setting timezone to UTC"
cp --remove-destination \
"${ROOT}/usr/share/zoneinfo/UTC" \
"${ROOT}/etc/localtime"
fi
}
|