Merge branch 'tizen' of git.vannes:/srv/git/gitcache/review.tizen.org//scm/bb/meta...
[scm/bb/meta-tizen.git] / recipes-tizen / rpm / rpm-extraconf.inc
1 SRC_URI += "file://disable_debuginfo.patch \
2             file://disable_shortcircuited.patch \
3             file://fix_libdir.patch \
4             file://rpm-scriptetexechelp.patch \
5             file://fix-python-rpm-conf.patch \
6             file://rpmmodule.c.patch \
7             file://python-rpm.Makefile.am.patch \
8             file://pythondeps.sh \
9            "
10
11 DEPENDS += "popt-native"
12 DEPENDS += "uthash-native"
13 DEPENDS += "smack-native"
14 DEPENDS += "acl-native"
15 DEPENDS += "lua-native"
16 DEPENDS += "python-native"
17
18 CFLAGS_append = " -DRPM_VENDOR_OE "
19
20 #BBCLASSEXTEND += " nativesdk "
21
22 do_compile_prepend() {
23  cd ${S}
24  LANG=C
25  export LANG
26  unset DISPLAY
27  CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ;
28  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ;
29  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir }" ; export FFLAGS ;
30  LD_AS_NEEDED=1; export LD_AS_NEEDED ;
31
32  ### BUILD BEGIN ###
33  CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss`"
34  export CPPFLAGS
35  export CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -ffunction-sections"
36  export LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic-functions -ffunction-sections"
37
38  export CCFLAGS+=" -fPIC "
39  export CXXFLAGS+=" -fPIC "
40  export CFLAGS+=" -fPIC "
41
42  cd db3
43  ./configure --build=${TARGET_SYS} --host=x86_64-linux-gnu
44  cd ..
45
46  cp db3/configure  db3/configure.ac
47
48  export CFLAGS+=" -DRPM_VENDOR_OE "
49 }
50
51 do_compile() {
52  cd ${S}
53  LANG=C
54  export LANG
55  unset DISPLAY
56  CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ;
57  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ;
58  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir }" ; export FFLAGS ;
59  LD_AS_NEEDED=1; export LD_AS_NEEDED ;
60
61  CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss`"
62  export CPPFLAGS
63  export CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -ffunction-sections"
64  export LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic-functions -ffunction-sections"
65
66  BUILDTARGET="--host=x86_64-linux-gnu "
67
68
69    CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CFLAGS ;
70    CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables} " ; export CXXFLAGS ;
71    FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir } " ; export FFLAGS ;
72    export CFLAGS+=" -DRPM_VENDOR_OE "
73    autoreconf -i -f
74    ./configure   --host=${HOST_SYS} \
75          --target=x86_64-tizen-linux \
76          --program-prefix= \
77          --prefix=${prefix} \
78          --exec-prefix=${prefix} \
79          --bindir=${prefix}/bin \
80          --sbindir=${prefix}/sbin \
81          --sysconfdir=${sysconfdir} \
82          --datadir=${prefix}/share \
83          --includedir=${prefix}/include \
84          --libdir=${prefix}/lib \
85          --libexecdir=${prefix}/libexec \
86          --localstatedir=${localstatedir} \
87          --sharedstatedir=${prefix}/com \
88          --mandir=${mandir} \
89          --infodir=${infodir} \
90      --disable-dependency-tracking \
91      --with-lua \
92      --with-acl \
93      --with-cap \
94      --enable-shared \
95      --enable-python \
96      --with-python-inc-dir=${STAGING_INCDIR}/python${PYTHON_BASEVERSION} \
97      --with-python-lib-dir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
98      --with-msm \
99      $BUILDTARGET
100
101  make -j16
102
103
104
105 }
106
107 do_install() {
108  echo export RPM_BUILD_ROOT=${D}
109  cd ${S}
110  LANG=C
111  export LANG
112  unset DISPLAY
113  rm -rf ${D}
114  mkdir -p ${D}
115
116  mkdir -p ${D}${prefix}/lib
117  mkdir -p ${D}${prefix}/share/locale
118  ln -s ../share/locale ${D}${prefix}/lib/locale
119
120    oe_runmake \
121          DESTDIR=${D} \
122          INSTALL_ROOT=${D} \
123          BINDIR=${prefix}/bin \
124    install
125    rm -f ${D}${infodir}/dir
126    find ${D} -regex ".*\.la$" | xargs rm -f --
127    find ${D} -regex ".*\.a$" | xargs rm -f --
128  install -m 644 db3/db.h ${D}${prefix}/include/rpm
129  mkdir -p ${D}${sysconfdir}/rpm
130  cp -a tizen_macros ${D}${prefix}/lib/rpm
131  mkdir -p ${D}${prefix}/lib/rpm/tizen
132  install -m 755 ${S}/packaging/find-docs.sh ${D}${prefix}/lib/rpm/tizen
133  install -m 755 ${S}/packaging/find-provides.ksyms ${D}${prefix}/lib/rpm
134  install -m 644 ${S}/packaging/device-sec-policy ${D}${sysconfdir}/device-sec-policy
135  install -m 644 ${S}/packaging/device-sec-policy ${D}${prefix}/lib/rpm-plugins/msm-device-sec-policy
136  ln -s ../tizen_macros ${D}${prefix}/lib/rpm/tizen/macros
137  for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
138    mkdir -p ${D}${prefix}/src/packages/$d
139    chmod 755 ${D}${prefix}/src/packages/$d
140  done
141  for d in ${D}${prefix}/lib/rpm/platform/*-linux/macros ; do
142    dd=${d%-linux/macros}
143    dd=${dd##*/}
144    mkdir -p ${D}${prefix}/src/packages/RPMS/$dd
145    chmod 755 ${D}${prefix}/src/packages/RPMS/$dd
146  done
147  mkdir -p ${D}${localstatedir}/lib/rpm
148  gzip -9 ${D}${mandir}/man[18]/*.[18]
149  export RPM_BUILD_ROOT
150  chmod 755 doc/manual
151  rm -rf doc/manual/Makefile*
152  rm -f ${D}${prefix}/lib/rpmpopt
153  rm -rf ${D}${mandir}/{fr,ja,ko,pl,ru,sk}
154  rm -f ${D}${prefix}/share/locale/de/LC_MESSAGES/rpm.mo
155  rm -f ${D}${prefix}/lib/rpm/cpanflute ${D}${prefix}/lib/rpm/cpanflute2
156  install -m 755 scripts/find-supplements{,.ksyms} ${D}${prefix}/lib/rpm
157  install -m 755 scripts/firmware.prov ${D}${prefix}/lib/rpm
158  install -m 755 scripts/debuginfo.prov ${D}${prefix}/lib/rpm
159  rm -f ${D}${prefix}/lib/locale ${D}${prefix}/lib/rpmrc
160  mkdir -p ${D}${sysconfdir}/rpm
161  chmod 755 ${D}${sysconfdir}/rpm
162  mkdir -p ${D}${prefix}/lib/rpm/macros.d
163  # remove some nonsense or non-working scripts
164  pushd ${D}${prefix}/lib/rpm/
165  for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
166           magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
167           brp-strip-static-archive vpkg-provides*.sh http.req sql.req tcl.req \
168           rpmdb_* brp-sparc64-linux brp-strip-comment-note brp-java-gcjcompile
169  do
170      rm -f $f
171  done
172  for i in ${prefix}/share/automake-*/*; do
173    if test -f "$i" && test -f "${i##*/}"; then
174      rm -f "${i##*/}"
175    fi
176  done
177  popd
178  rm -f ${D}${prefix}/lib/*.la
179  rm -f ${D}${prefix}/lib/rpm-plugins/*.la
180
181
182   _target="";
183   _symlinks=0;
184
185  #sh ${D}${prefix}/lib/rpm/find-lang.sh ${D} rpm
186
187
188
189 }
190
191
192
193 do_install_append() {
194  rm -fr ${D}/var/tmp
195  rm -fr ${D}/var/volatile
196
197  mkdir -p ${D}${prefix}/lib/rpm/bin
198  ln -s ../debugedit ${D}${prefix}/lib/rpm/bin/debugedit
199  ln -s ../rpmdeps ${D}${prefix}/lib/rpm/bin/rpmdeps-oecore
200 }
201
202 FILES_${PN}-dbg += "\
203     ${libdir}/rpm-plugins/.debug/* \
204     ${libdir}/python2.7/site-packages/rpm/.debug/* \
205     "
206
207 PROVIDES += " python-rpm "
208
209 DEPENDS_native += "popt-native"
210 DEPENDS_native += "uthash-native"
211 DEPENDS_native += "smack-native"