aboutsummaryrefslogtreecommitdiffstats
path: root/uclibc-snapshot/uclibc-snapshot_cvs.oe
blob: 30f76297514bbb4ed7b6f4117693adbbcfc091a3 (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
DESCRIPTION = "C library for embedded systems"
LICENSE = "LGPL"
SECTION = "libs"
PRIORITY = "required"
MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
PV = "${CVSDATE}"
PR = "r1"

#
# For now, we will skip building of a gcc package if it is a uclibc one
# and our build is not a uclibc one, and we skip a glibc one if our build
# is a uclibc build.
#
# See the note in gcc/gcc_3.4.0.oe
#

python __anonymous () {
    import oe, re
    uc_os = (re.match('.*uclibc$', oe.data.getVar('TARGET_OS', d, 1)) != None)
    if not uc_os:
        raise oe.parse.SkipPackage("incompatible with target %s" %
                                   oe.data.getVar('TARGET_OS', d, 1))
}

PROVIDES += " virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
DEPENDS = "patcher-native virtual/${TARGET_PREFIX}binutils \
	   virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers"
INHIBIT_DEFAULT_DEPS = "1"

#
# This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
# build, it does not need to be unpacked, but we can't inhibit the unpacking
# in the current build system.
#
UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"

SRC_URI = "cvs://anonymous:@166.70.99.138/var/cvs;module=uClibc \
	   ${UCLIBC_LOCALE_URI} \
           file://nokernelheadercheck.patch;patch=1 \
           file://uClibc.config"

S = "${WORKDIR}/uClibc"

UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"

EXTRA_OEMAKE = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
		'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${CROSS_DIR}/${TARGET_SYS}/include",g; \
		s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
		s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
		s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
		s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g;'

python () {
	if oe.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
		oe.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
}

uclibcbuild_do_patch() {
	ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
	ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
	
	cp ${DL_DIR}/${UCLIBC_LOCALE_FILE} extra/locale
}

python do_patch () {
	oe.build.exec_func('base_do_patch', d)
	oe.build.exec_func('uclibcbuild_do_patch', d)
}

do_configure() {
	cp ${WORKDIR}/uClibc.config ${S}/.config

	perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
	perl -i -p -e '${configmangle}' ${S}/.config

	oe_runmake oldconfig
}

do_stage() {
	# Install into the cross dir (this MUST be done first because we
	# will install crt1.o in the install_dev stage and gcc needs it)
	oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
		RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
		install_dev install_runtime install_utils

	# We don't really need this
	rm -f ${UCLIBC_PREFIX}/include/.cvsignore

	# Fixup shared lib symlinks
	( cd ${UCLIBC_PREFIX}/lib
		for f in c crypt dl m nsl pthread resolv thread_db util; do
			ln -sf lib${f}.so.? lib${f}.so
		done
	)

	# This conflicts with the c++ version of this header
	rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h

	# Install into the staging dir
	oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
		RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
		install_dev install_runtime install_utils

	# We don't really need this
	rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore

	# Fixup shared lib symlinks
	( cd ${UCLIBC_STAGE_PREFIX}/lib
		for f in c crypt dl m nsl pthread resolv thread_db util; do
			ln -sf lib${f}.so.? lib${f}.so
		done
	)

	# This conflicts with the c++ version of this header
	rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
}

do_install() {
	oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
		install_dev install_runtime install_utils

	# We don't really need this in /usr/include
	rm -f ${D}/${prefix}/include/.cvsignore

	# This conflicts with the c++ version of this header
	rm -f ${D}/${prefix}/include/bits/atomicity.h
}