summaryrefslogtreecommitdiffstats
path: root/build
blob: 45247bbbecf243cdc9d2f5b4052469cbba7c4996 (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
#! /usr/bin/make -f

prefix = /usr
datarootdir = $(prefix)/share
datadir = $(prefix)/share
localedir = $(prefix)/lib/locale
docdir = $(prefix)/share/doc

SUPPORTED_LOCALES = \
	de_DE.UTF-8/UTF-8 de_DE/ISO-8859-1 de_DE@euro/ISO-8859-15 \
	en_HK.UTF-8/UTF-8 en_HK/ISO-8859-1 \
	en_PH.UTF-8/UTF-8 en_PH/ISO-8859-1 \
	en_US.UTF-8/UTF-8 en_US/ISO-8859-1 \
	es_MX.UTF-8/UTF-8 es_MX/ISO-8859-1 \
	fa_IR/UTF-8 \
	fr_FR.UTF-8/UTF-8 fr_FR/ISO-8859-1 fr_FR@euro/ISO-8859-15 \
	it_IT.UTF-8/UTF-8 it_IT/ISO-8859-1 \
	ja_JP.EUC-JP/EUC-JP ja_JP.UTF-8/UTF-8

nop:
	@:

configure-libc:
	[ ! -d libcbuild ] && mkdir libcbuild || true
	rm -f libcbuild/config.cache
	echo 'libc_cv_forced_unwind=yes' >>libcbuild/config.cache
	echo 'libc_cv_c_cleanup=yes'     >>libcbuild/config.cache
	echo 'libc_cv_gnu89_inline=yes'  >>libcbuild/config.cache
	echo 'libc_cv_ssp=no'            >>libcbuild/config.cache
	echo 'libc_cv_slibdir=/lib/'"$${OPK_HOST_ARCH}" \
		>>libcbuild/config.cache
	if [ -n "$${TOOLS_PREFIX}" ]; then \
		BINUTILS="--with-binutils=$${TOOLS_PREFIX}/bin"; \
	else \
		BINUTILS=; \
	fi && \
	if [ -n "$${HEADERS_PREFIX}" ]; then \
		HEADERS="--with-headers=$${HEADERS_PREFIX}/usr/include"; \
	else \
		HEADERS=; \
	fi && \
	BUILD_CC=gcc BUILD_CXX=g++ oh-autoconfigure \
		-s "$${PWD}/src/libc" -B libcbuild -- \
		--datarootdir=$(datarootdir) --datadir=$(datadir) \
		--localedir=$(localedir) --docdir=$(docdir) \
		--disable-profile \
		--enable-add-ons=ports,nptl,libidn \
		--enable-kernel=3.2.0 \
		--with-tls --with-__thread --without-cvs \
		--without-selinux --without-gd \
		$${BINUTILS} \
		$${HEADERS} \
		--cache-file=config.cache
	touch $@

configure-locales:
	[ ! -d localesbuild ] && mkdir localesbuild || true
	CPPFLAGS=-DNOT_IN_libc oh-autoconfigure \
		-s "$${PWD}/src/localedef" -B localesbuild -- \
		--libdir='$${prefix}/lib' \
		--with-glibc=../src/libc
	touch $@

configure: configure-libc configure-locales
	touch $@

build-libc: configure-libc
	oh-autobuild -s "$${PWD}/src/libc" -B libcbuild -- -j $${JOBS:-1}
	touch $@

build-locales: configure-locales
	oh-autobuild -s "$${PWD}/src/localedef" -B localesbuild -- \
		-j $${JOBS:-1}
	touch $@

build: build-libc build-locales
	touch $@

install-libc: build-libc
	# Install /etc/ld.so.conf early to silence a warning from ldconfig.
	mkdir -p dest/etc
	cp ../ld.so.conf dest/etc
	oh-autoinstall -s "$${PWD}/src/libc" -B libcbuild
	rm -f dest/var/db/Makefile \
		dest/sbin/sln \
		dest/usr/bin/makedb \
		dest/usr/bin/pcprofiledump \
		dest/usr/bin/xtrace
	# TODO: PIC package?
	rm -Rf dest/usr/lib/*/*_pic.*
	rm -Rf dest/usr/lib/*/libc_pic/
	# pt_chown isn't necessary with Linux's devptsfs.
	[ "x${OPK_HOST_ARCH_KERNEL}" = 'xlinux' ] && \
		rm -f dest/usr/lib/*/pt_chown
	cp ../nsswitch.conf dest/etc
	rm -f dest/etc/ld.so.cache

install-locales: build-locales
	oh-autoinstall -s "$${PWD}/src/localedef" -B localesbuild \
		-T install-locales \
		SUPPORTED-LOCALES='$(SUPPORTED_LOCALES)'

install: install-libc install-locales
	oh-fixperms
	oh-strip -k
	oh-installfiles

clean-libc:
	oh-autoclean -s "$${PWD}/src/libc" -B libcbuild
	rm -f configure-libc build-libc

clean-locales:
	oh-autoclean -s "$${PWD}/src/localedef" -B localesbuild
	rm -f configure-locales build-locales

clean: clean-libc clean-locales
	rm -f configure build
	rm -Rf *.data

# POSIX.1-2008:
#   If the pathname does not begin with a '/' it shall be treated as relative to
#   the current working directory of the process, not relative to the directory
#   containing the makefile.
include ../source.mk