]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/uclibc/uclibc.inc
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / uclibc / uclibc.inc
1 DESCRIPTION = "C library for embedded systems"
2 LICENSE = "LGPL"
3 SECTION = "libs"
4 PRIORITY = "required"
5 MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
6
7 #
8 # For now, we will skip building of a gcc package if it is a uclibc one
9 # and our build is not a uclibc one, and we skip a glibc one if our build
10 # is a uclibc build.
11 #
12 # See the note in gcc/gcc_3.4.0.oe
13 #
14
15 python __anonymous () {
16     import bb, re
17     uc_os = (re.match('.*uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None)
18     if not uc_os:
19         raise bb.parse.SkipPackage("incompatible with target %s" %
20                                    bb.data.getVar('TARGET_OS', d, 1))
21 }
22
23 PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
24 PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}"
25 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
26            virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers"
27 INHIBIT_DEFAULT_DEPS = "1"
28 PARALLEL_MAKE = ""
29
30 PACKAGES = "uclibc ldd uclibc-utils uclibc-gconv uclibc-dev uclibc-doc uclibc-thread-db"
31
32 uclibc_baselibs = "/lib/libcrypt*.so* /lib/libdl*.so \
33                    /lib/libintl*.so* /lib/libm*.so \
34                    /lib/libnsl*.so* /lib/libpthread*.so \
35                    /lib/libresolv*.so* /lib/libutil*.so \
36                    /lib/libuClibc*.so* /lib/ld*.so* \
37                    /lib/libc*.so* /lib/libdl*.so* \
38                    /lib/libm*.so* /lib/libutil*.so* \
39                    /lib/libpthread*.so* /lib/librt*.so*"
40 FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
41                ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
42 FILES_ldd = "${bindir}/ldd"
43 FILES_uclibc-dev += "${libdir}/*.o"
44 FILES_uclibc-utils = "${bindir} ${sbindir}"
45 FILES_uclibc-gconv = "${libdir}/gconv"
46 FILES_uclibc-thread-db = "/lib/libthread_db*"
47 RPROVIDES_uclibc-dev += "libc-dev"
48
49 #
50 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
51 # build, it does not need to be unpacked, but we can't inhibit the unpacking
52 # in the current build system.
53 #
54 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
55 UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz"
56 UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}"
57 UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}"
58
59 SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \
60            file://uClibc.config"
61
62 UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
63 UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
64
65 # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
66 # the CFLAGS (for when building the utils).
67 OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
68                 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
69 EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'"
70 EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
71 EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
72
73 KERNEL_SOURCE = "${CROSS_DIR}/${TARGET_SYS}/include"
74
75 configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \
76                 s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
77                 s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
78                 s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \
79                 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
80                 ${@["s,.*UCLIBC_HAS_LOCALE.*,# UCLIBC_HAS_LOCALE is not set,;", ""][bb.data.getVar("USE_NLS", d, 1) == "yes"]}'
81 CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
82
83 python () {
84         if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
85                 bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d)
86 }
87
88 uclibcbuild_do_patch() {
89         ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux
90         ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm
91         
92         ${@['cp %s/%s extra/locale' % (bb.data.getVar('DL_DIR', d, 1) or '', bb.data.getVar('UCLIBC_LOCALE_FILE', d, 1) or ''), ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}
93 }
94
95 python do_patch () {
96         bb.build.exec_func('base_do_patch', d)
97         bb.build.exec_func('uclibcbuild_do_patch', d)
98 }
99
100 do_configure() {
101         cp ${WORKDIR}/uClibc.config ${S}/.config
102
103         perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
104         perl -i -p -e '${configmangle}' ${S}/.config
105
106         oe_runmake oldconfig
107 }
108
109 do_stage() {
110         # Install into the cross dir (this MUST be done first because we
111         # will install crt1.o in the install_dev stage and gcc needs it)
112         oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
113                 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
114                 install_dev install_runtime
115
116         oe_runmake utils
117         oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
118                 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
119                 install_utils
120
121         # We don't really need this
122         rm -f ${UCLIBC_PREFIX}/include/.cvsignore
123
124         # Fixup shared lib symlinks
125         ( cd ${UCLIBC_PREFIX}/lib
126                 for f in c crypt dl m nsl pthread resolv thread_db util; do
127                         ln -sf lib${f}.so.? lib${f}.so
128                 done
129         )
130
131         # This conflicts with the c++ version of this header
132         rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h
133
134         # Install into the staging dir
135         oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
136                 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
137                 install_dev install_runtime install_utils
138
139         # We don't really need this
140         rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
141
142         # Fixup shared lib symlinks
143         ( cd ${UCLIBC_STAGE_PREFIX}/lib
144                 for f in c crypt dl m nsl pthread resolv thread_db util; do
145                         ln -sf lib${f}.so.? lib${f}.so
146                 done
147         )
148
149         # This conflicts with the c++ version of this header
150         rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
151 }
152
153 do_install() {
154         oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
155                 install_dev install_runtime install_utils
156
157         # We don't really need this in ${includedir}
158         rm -f ${D}${prefix}/include/.cvsignore
159
160         # This conflicts with the c++ version of this header
161         rm -f ${D}${prefix}/include/bits/atomicity.h
162
163         # ugh.. uclibc doesn't like obeying our path variables.
164         if [ "${includedir}" != "${prefix}/include" ]; then
165                 install -d ${D}${includedir}
166                 mv ${D}${prefix}/include/* ${D}${includedir}/
167                 rmdir ${D}${prefix}/include
168         fi
169
170         if [ "${libdir}" != "${prefix}/lib" ]; then
171                 install -d ${D}${libdir}
172                 mv ${D}${prefix}/lib/* ${D}${libdir}/
173                 rmdir ${D}${prefix}/lib
174         fi
175
176         if [ "${bindir}" != "/usr/bin" ]; then
177                 install -d ${D}${bindir}
178                 mv ${D}/usr/bin/* ${D}${bindir}/
179                 rmdir ${D}/usr/bin
180         fi
181 }
182