summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Ouyang <Xin.Ouyang@windriver.com>2012-02-06 17:37:49 +0800
committerXin Ouyang <Xin.Ouyang@windriver.com>2012-02-06 17:37:49 +0800
commit44ad61c9c426eea5c9c114d567bc6b0ca3f839bc (patch)
tree127821baadad21ce75a53aa38e1ce1acd868df26
parentbd6350f6232f7fa9e715b8ff00edfb69ce6e39fe (diff)
downloadmeta-selinux-44ad61c9c426eea5c9c114d567bc6b0ca3f839bc.tar.gz
ustr: Modify for cross-compiling and native build.
-rw-r--r--recipes-security/ustr/ustr/ustr-makefile-fix.patch215
-rw-r--r--recipes-security/ustr/ustr_1.0.4.bb49
2 files changed, 242 insertions, 22 deletions
diff --git a/recipes-security/ustr/ustr/ustr-makefile-fix.patch b/recipes-security/ustr/ustr/ustr-makefile-fix.patch
new file mode 100644
index 0000000..b07e746
--- /dev/null
+++ b/recipes-security/ustr/ustr/ustr-makefile-fix.patch
@@ -0,0 +1,215 @@
1---
2 Makefile | 109 ++++++++++++++++++++++++++-------------------------------------
3 1 file changed, 46 insertions(+), 63 deletions(-)
4
5--- a/Makefile
6+++ b/Makefile
7@@ -7,35 +7,36 @@ VERS_FULL=$(VERS).4
8 VERS_BSO =1.0
9 VERS_ESONAME =1
10 VERS_ESO =$(VERS_ESONAME).0.4
11
12 DESTDIR =
13-prefix=/usr
14-datadir=$(prefix)/share
15-libdir=$(prefix)/lib
16-libexecdir=$(prefix)/libexec
17-bindir=$(prefix)/bin
18-includedir=$(prefix)/include
19-SHRDIR=$(datadir)/ustr-$(VERS_FULL)
20-DOCSHRDIR=$(datadir)/doc/ustr-devel-$(VERS_FULL)
21-EXAMDIR=$(SHRDIR)/examples
22-mandir=$(datadir)/doc/man
23-MBINDIR=$(libexecdir)/ustr-$(VERS_FULL)
24+prefix ?= /usr
25+datadir ?= $(prefix)/share
26+libdir ?= $(prefix)/lib
27+libexecdir ?= $(prefix)/libexec
28+bindir ?= $(prefix)/bin
29+includedir ?= $(prefix)/include
30+SHRDIR ?= $(datadir)/ustr-$(VERS_FULL)
31+DOCSHRDIR ?= $(datadir)/doc/ustr-devel-$(VERS_FULL)
32+EXAMDIR ?= $(SHRDIR)/examples
33+mandir ?=$(datadir)/doc/man
34+MBINDIR ?=$(libexecdir)/ustr-$(VERS_FULL)
35
36 ###############################################################################
37 # This is here to work around the "Fedora build system requirement" that a big
38 # pile of crap ends up in the build.log file even though all sane people don't
39 # want that. See rhbz#248231
40 ###############################################################################
41-HIDE=@
42+#HIDE=@
43
44-CC = cc
45-AR = ar
46-RANLIB = ranlib
47-LDCONFIG = /sbin/ldconfig
48+vsnp ?= 0
49+CC ?= cc
50+AR ?= ar
51+RANLIB ?= ranlib
52+LDCONFIG ?= /sbin/ldconfig
53
54-CFLAGS = -O2 -g
55+CFLAGS ?= -O2 -g
56
57 # Debug versions...
58 WARNS = -W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security # -Wfloat-equal -- no floats
59 # Fedora policies/"reviewers" are completely retarded and refuse to allow
60 # lowering the "Fedora build flags" even when it activley hurts their users,
61@@ -386,48 +387,46 @@ install: all-shared ustr.pc ustr-debug.p
62 install -d $(DESTDIR)$(mandir)/man1
63 install -d $(DESTDIR)$(mandir)/man3
64 install -d $(DESTDIR)$(bindir)
65 install -d $(DESTDIR)$(libdir)/pkgconfig
66 $(HIDE)echo Installing files
67- install -m 644 -t $(DESTDIR)$(libdir) $(LIB_STATIC)
68- install -m 755 -t $(DESTDIR)$(libdir) $(LIB_SHARED)
69+ install -m 644 $(LIB_STATIC) $(DESTDIR)$(libdir)
70+ install -m 755 $(LIB_SHARED) $(DESTDIR)$(libdir)
71 -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
72 ln -s $(OPT_LIB_SHARED) $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
73 -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
74 ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
75 -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
76 ln -s $(DBG_LIB_SHARED) $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
77 -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
78 ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
79 $(LDCONFIG) -n $(DESTDIR)$(libdir)
80- install -pm 644 -t $(DESTDIR)$(includedir) $(SRC_HDRS)
81- install -pm 644 -t $(DESTDIR)$(SHRDIR) $(SRC_SRCS)
82- install -pm 644 -t $(DESTDIR)$(SHRDIR) $(XSRC_SRCS)
83- install -pm 644 -t $(DESTDIR)$(DOCSHRDIR) $(DOCS)
84- install -pm 644 -t $(DESTDIR)$(EXAMDIR) $(EXAMPLES)
85- install -pm 644 -t $(DESTDIR)$(mandir)/man1 $(MAN_PAGES_1)
86- install -pm 644 -t $(DESTDIR)$(mandir)/man3 $(MAN_PAGES_3)
87- install -m 755 -t $(DESTDIR)$(bindir) ustr-import
88- install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc ustr-debug.pc
89+ install -pm 644 $(SRC_HDRS) $(DESTDIR)$(includedir)
90+ install -pm 644 $(SRC_SRCS) $(DESTDIR)$(SHRDIR)
91+ install -pm 644 $(XSRC_SRCS) $(DESTDIR)$(SHRDIR)
92+ install -pm 644 $(DOCS) $(DESTDIR)$(DOCSHRDIR)
93+ install -pm 644 $(EXAMPLES) $(DESTDIR)$(EXAMDIR)
94+ install -pm 644 $(MAN_PAGES_1) $(DESTDIR)$(mandir)/man1
95+ install -pm 644 $(MAN_PAGES_3) $(DESTDIR)$(mandir)/man3
96+ install -m 755 ustr-import $(DESTDIR)$(bindir)
97+ install -pm 644 ustr.pc ustr-debug.pc $(DESTDIR)$(libdir)/pkgconfig
98
99 ustr-import-multilib: ustr-import-multilib.in
100 sed -e 's,@INCLUDEDIR@,$(includedir),g' -e 's,@MBINDIR@,$(MBINDIR),g' < $< > $@
101
102-install-multilib-linux: install autoconf_64b ustr-import-multilib
103+install-multilib-linux: install ustr-import-multilib
104 install -d $(DESTDIR)$(MBINDIR)
105- $(HIDE)mlib=`./autoconf_64b`; \
106- if test "x$$mlib" = "x1"; then mlib=64; else mlib=32; fi; \
107- mv -f $(DESTDIR)$(includedir)/ustr-conf-debug.h \
108- $(DESTDIR)$(includedir)/ustr-conf-debug-$$mlib.h; \
109+ mv -f $(DESTDIR)$(includedir)/ustr-conf-debug.h \
110+ $(DESTDIR)$(includedir)/ustr-conf-debug-$(mlib).h; \
111 mv -f $(DESTDIR)$(includedir)/ustr-conf.h \
112- $(DESTDIR)$(includedir)/ustr-conf-$$mlib.h; \
113+ $(DESTDIR)$(includedir)/ustr-conf-$(mlib).h; \
114 mv -f $(DESTDIR)$(bindir)/ustr-import \
115- $(DESTDIR)$(MBINDIR)/ustr-import-$$mlib
116- install -m 644 -t $(DESTDIR)$(includedir) $(SRC_HDRS_MULTI_LIB)
117+ $(DESTDIR)$(MBINDIR)/ustr-import-$(mlib)
118+ install -m 644 $(SRC_HDRS_MULTI_LIB) $(DESTDIR)$(includedir)
119 $(HIDE)mv -f $(DESTDIR)$(includedir)/ustr-conf-debug-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf-debug.h
120 $(HIDE)mv -f $(DESTDIR)$(includedir)/ustr-conf-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf.h
121- install -m 755 -t $(DESTDIR)$(bindir) ustr-import-multilib
122+ install -m 755 ustr-import-multilib $(DESTDIR)$(bindir)
123 $(HIDE)mv -f $(DESTDIR)$(bindir)/ustr-import-multilib $(DESTDIR)$(bindir)/ustr-import
124 $(HIDE)touch --reference ustr-conf-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf.h
125 $(HIDE)touch --reference ustr-conf-debug-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf-debug.h
126 $(HIDE)touch --reference ustr-import-multilib.in $(DESTDIR)$(bindir)/ustr-import
127
128@@ -442,31 +441,20 @@ clean:
129 $(HIDE)rm -f tst_*.c ctst_*.c otst_*.c octst_*.c
130 $(HIDE)rm -f ustr-import-multilib
131
132 distclean: clean
133 rm -f ustr-import
134- rm -f autoconf_64b autoconf_vsnprintf
135 rm -f ustr-conf.h ustr-conf-debug.h
136 rm -rf lcov-output
137
138
139-ustr-import: ustr-import.in autoconf_64b autoconf_vsnprintf
140+ustr-import: ustr-import.in
141 $(HIDE)echo Creating $@
142- $(HIDE)sz64=`./autoconf_64b`; vsnp=`./autoconf_vsnprintf`; \
143- sed -e 's,@INCLUDEDIR@,$(includedir),g' -e 's,@SHRDIR@,$(SHRDIR),g' -e 's,@VERS@,$(VERS),g' -e 's,@VERS_FULL@,$(VERS_FULL),g' -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$$vsnp,g" < $< > $@
144+ $(HIDE)if test "$(mlib)" = "64" ; then sz64=1; else sz64=0; fi; \
145+ sed -e 's,@INCLUDEDIR@,$(includedir),g' -e 's,@SHRDIR@,$(SHRDIR),g' -e 's,@VERS@,$(VERS),g' -e 's,@VERS_FULL@,$(VERS_FULL),g' -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$(vsnp),g" < $< > $@
146 $(HIDE)chmod 755 $@
147
148-# Use CFLAGS so that CFLAGS="... -m32" does the right thing
149-autoconf_64b: autoconf_64b.c
150- $(HIDE)echo Compiling: auto configuration test: 64bit
151- $(HIDE)$(CC) $(CFLAGS) -o $@ $<
152-
153-autoconf_vsnprintf: autoconf_vsnprintf.c
154- $(HIDE)echo Compiling: auto configuration test: vsnprintf
155- $(HIDE)$(CC) -o $@ $<
156-
157-# Use LDFLAGS for LDFLAGS="-m32"
158 $(OPT_LIB_SHARED): $(LIB_SHARED_OPT)
159 $(HIDE)echo Linking SO OPT lib: $@
160 $(HIDE)$(CC) -shared $^ -Wl,-soname -Wl,$(OPT_LIB_SHARED_NAME) -Wl,-version-script -Wl,libustr.ver $(LDFLAGS) -o $@
161
162 $(DBG_LIB_SHARED): $(LIB_SHARED_DBG)
163@@ -480,46 +468,40 @@ libustr.a: $(LIB_STATIC_OPT)
164 libustr-debug.a: $(LIB_STATIC_DBG)
165 $(HIDE)echo Linking A DBG lib: $@
166 $(HIDE)$(AR) ru $@ $^
167 $(HIDE)$(RANLIB) $@
168
169-ustr-conf.h: ustr-conf.h.in autoconf_64b autoconf_vsnprintf
170+ustr-conf.h: ustr-conf.h.in
171 $(HIDE)echo Creating $@
172 $(HIDE)have_stdint_h=0; dbg1=0; dbg2=0; \
173- sz64=`./autoconf_64b`; vsnp=`./autoconf_vsnprintf`; \
174- if test -f "/usr/include/stdint.h"; then have_stdint_h=1; fi; \
175+ $(HIDE)if test "$(mlib)" = "64" ; then sz64=1; else sz64=0; fi; \
176 if test -f "$(prefix)/include/stdint.h"; then have_stdint_h=1; fi; \
177 if test -f "$(includedir)/stdint.h"; then have_stdint_h=1; fi; \
178- sed -e "s,@HAVE_STDINT_H@,$$have_stdint_h,g" -e "s,@USE_ASSERT@,$$dbg1,g" -e "s,@USE_EOS_MARK@,$$dbg2,g" -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$$vsnp,g" < $< > $@
179+ sed -e "s,@HAVE_STDINT_H@,$$have_stdint_h,g" -e "s,@USE_ASSERT@,$$dbg1,g" -e "s,@USE_EOS_MARK@,$$dbg2,g" -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$(vsnp),g" < $< > $@
180
181-ustr-conf-debug.h: ustr-conf.h.in autoconf_64b autoconf_vsnprintf
182+ustr-conf-debug.h: ustr-conf.h.in
183 $(HIDE)echo Creating $@
184 $(HIDE)have_stdint_h=0; dbg1=1; dbg2=1; \
185- sz64=`./autoconf_64b`; vsnp=`./autoconf_vsnprintf`; \
186- if test -f "/usr/include/stdint.h"; then have_stdint_h=1; fi; \
187+ $(HIDE)if test "$(mlib)" = "64" ; then sz64=1; else sz64=0; fi; \
188 if test -f "$(prefix)/include/stdint.h"; then have_stdint_h=1; fi; \
189 if test -f "$(includedir)/stdint.h"; then have_stdint_h=1; fi; \
190- sed -e "s,@HAVE_STDINT_H@,$$have_stdint_h,g" -e "s,@USE_ASSERT@,$$dbg1,g" -e "s,@USE_EOS_MARK@,$$dbg2,g" -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$$vsnp,g" < $< > $@
191+ sed -e "s,@HAVE_STDINT_H@,$$have_stdint_h,g" -e "s,@USE_ASSERT@,$$dbg1,g" -e "s,@USE_EOS_MARK@,$$dbg2,g" -e "s,@HAVE_64bit_SIZE_MAX@,$$sz64,g" -e "s,@HAVE_RETARDED_VSNPRINTF@,$(vsnp),g" < $< > $@
192
193
194 # We don't use $(DEPS_NONC_ALL) as deps. because it then recompiles everything
195 # too much, and we care about speed more. Do make clean to "fix".
196 # Yes, scons fixes this.
197 %-code-so-opt.o: %-opt-code.c %-code.h %.h $(DEPS_C_ALL)
198- $(HIDE)echo Compiling for SO OPT lib: $<
199 $(HIDE)$(CC) $(CFLAGS) -fPIC $(CFLG_LIB_OPT) -o $@ -c $<
200
201 %-code-so-dbg.o: %-dbg-code.c %-code.h %.h $(DEPS_C_ALL)
202- $(HIDE)echo Compiling for SO DBG lib: $<
203 $(HIDE)$(CC) $(DBG_CFLAGS) -fPIC $(CFLG_LIB_DBG) -o $@ -c $<
204
205 %-code-a-opt.o: %-opt-code.c %-code.h %.h $(DEPS_C_ALL)
206- $(HIDE)echo Compiling for A OPT lib: $<
207 $(HIDE)$(CC) $(CFLAGS) $(CFLG_LIB_OPT) -o $@ -c $<
208
209 %-code-a-dbg.o: %-dbg-code.c %-code.h %.h $(DEPS_C_ALL)
210- $(HIDE)echo Compiling for A DBG lib: $<
211 $(HIDE)$(CC) $(DBG_CFLAGS) $(CFLG_LIB_DBG) -o $@ -c $<
212
213
214 perf-sizes: perf-sizes.c $(OBJS_C_OPT_ALL)
215 $(CC) $(WARNS) -O2 -g $(LDFLAGS) -o $@ $^
diff --git a/recipes-security/ustr/ustr_1.0.4.bb b/recipes-security/ustr/ustr_1.0.4.bb
index 9f0dbfc..5cef95d 100644
--- a/recipes-security/ustr/ustr_1.0.4.bb
+++ b/recipes-security/ustr/ustr_1.0.4.bb
@@ -11,38 +11,43 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c79c6e2ae13418d16d7dc82df960a1e7 \
11 file://LICENSE_LGPL;md5=d8045f3b8f929c1cb29a1e3fd737b499 \ 11 file://LICENSE_LGPL;md5=d8045f3b8f929c1cb29a1e3fd737b499 \
12 file://LICENSE_MIT;md5=c61e779b782608472bd87593c3c3916f" 12 file://LICENSE_MIT;md5=c61e779b782608472bd87593c3c3916f"
13 13
14SRC_URI = "http://www.and.org/ustr/1.0.4/ustr-1.0.4.tar.bz2" 14SRC_URI = "http://www.and.org/ustr/1.0.4/ustr-1.0.4.tar.bz2 \
15 file://ustr-makefile-fix.patch;patch=1"
15SRC_URI[md5sum] = "93147d9f0c9765d4cd0f04f7e44bdfce" 16SRC_URI[md5sum] = "93147d9f0c9765d4cd0f04f7e44bdfce"
16SRC_URI[sha256sum] = "3daf6eae9f78de1e872c0b2b83cce35515b94d4bb8a074e48f331fd99e1fc2c4" 17SRC_URI[sha256sum] = "3daf6eae9f78de1e872c0b2b83cce35515b94d4bb8a074e48f331fd99e1fc2c4"
17 18
18inherit lib_package 19inherit lib_package
20inherit siteinfo
19 21
20FILES_${PN} = "${base_libdir}/libustr-1.0.so.${PV} ${base_libdir}/libustr-1.0.so.1" 22FILES_${PN} = "${libdir}/libustr-1.0.so.*"
21 23
22FILES_${PN}-dev += "${datadir}/${PN}-${PV} ${bindir}/ustr-import ${libexecdir}/${PN}-${PV}/ustr-import-*" 24FILES_${PN}-dev += "${bindir}/ustr-import \
23FILES_${PN}-dev += "${libdir}/libustr-debug*" 25 ${libexecdir}/ustr-${PV}/ustr-import-* \
26 ${datadir}/.gdb_init \
27 ${datadir}/ustr-${PV} \
28 ${mandir}"
29
30FILES_${PN}-dbg += "${libdir}/libustr-debug* \
31 ${libdir}/pkgconfig/*-debug.* \
32 ${base_libdir}/debug/${libdir}"
33
34EXTRA_OEMAKE_virtclass-native = "prefix=/usr"
24 35
25do_compile() { 36do_compile() {
26 oe_runmake all-shared 37 oe_runmake all-shared
27} 38}
28 39
29do_install() { 40do_install() {
30 oe_runmake install-multilib-linux prefix=${prefix} \ 41 oe_runmake install-multilib-linux \
31 bindir=${bindir} mandir=${mandir} \ 42 mlib=${SITEINFO_BITS} \
32 datadir=${datadir} libdir=${libdir} \ 43 DESTDIR=${D} LDCONFIG=/bin/true
33 includedir=${includedir} libexecdir=${libexecdir} \ 44 mkdir -p ${D}/${datadir}/doc/${PN}-${PV}
34 DESTDIR=${D} LDCONFIG=/bin/true HIDE= 45 install ChangeLog ${D}/${datadir}/doc/${PN}-${PV}
35 46 install LICENSE* ${D}/${datadir}/doc/${PN}-${PV}
36 if [ "${base_libdir}" != "${libdir}" ]; then 47 install README ${D}/${datadir}/doc/${PN}-${PV}
37 mkdir -p ${D}${base_libdir} 48 install NEWS ${D}/${datadir}/doc/${PN}-${PV}
38 mv ${D}${libdir}/libustr-1.0.so.${PV} ${D}${base_libdir}/. 49 mv ${D}/${docdir}/ustr-devel-${PV}/strdup\ vs.\ ustr.gnumeric \
39 mv ${D}${libdir}/libustr-1.0.so.1 ${D}${base_libdir}/. 50 ${D}/${docdir}/ustr-devel-${PV}/strdup_vs._ustr.gnumeric
40
41 count=0 ; while [ -n "$libdir" -a "$libdir" != "." -a "$libdir" != "/" ]; do count=$(expr $count + 1); libdir=`dirname $libdir` ; done
42
43 relpath=""
44 newcount=0 ; while [ $newcount -lt $count ]; do if [ $newcount -ne 0 ]; then relpath+="/" ; fi ; relpath+=".." ; newcount=$(expr $newcount + 1) ; done
45
46 ln -sf $relpath/${base_libdir}/libustr-1.0.so.1 ${D}${libdir}/libustr.so
47 fi
48} 51}
52
53BBCLASSEXTEND = "native"