Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / classes / autotools.bbclass
index 1f03825..e43b289 100644 (file)
@@ -58,7 +58,6 @@ oe_runconf () {
                    --oldincludedir=${oldincludedir} \
                    --infodir=${infodir} \
                    --mandir=${mandir} \
-                                --enable-mainainer-mode \
                        ${EXTRA_OECONF} \
                    $@"
                oenote "Running $cfgcmd..."
@@ -135,7 +134,7 @@ autotools_do_configure() {
        ;;
        esac
        if [ -e ${S}/configure ]; then
-               oe_runconf
+               oe_runconf $@
        else
                oenote "nothing to configure"
        fi
@@ -143,13 +142,20 @@ autotools_do_configure() {
 
 autotools_do_install() {
        oe_runmake 'DESTDIR=${D}' install
+}
 
+do_install_append() {
         for i in `find ${D} -name "*.la"` ; do \
-            sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
-            sed -i -e s:${D}::g $i
-            sed -i -e 's:-I${WORKDIR}\S*: :g' $i
-            sed -i -e 's:-L${WORKDIR}\S*: :g' $i
-       done
+                sed -i -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${libdir}/\1,g' $i
+                sed -i -e s:${CROSS_DIR}/${HOST_SYS}::g $i
+                sed -i -e s:${CROSS_DIR}::g $i
+                sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
+                sed -i -e s:${STAGING_DIR_HOST}::g $i
+                sed -i -e s:${STAGING_DIR}::g $i
+                sed -i -e s:${S}::g $i
+                sed -i -e s:${T}::g $i
+                sed -i -e s:${D}::g $i
+        done
 }
 
 STAGE_TEMP="${WORKDIR}/temp-staging"
@@ -172,7 +178,7 @@ autotools_stage_dir() {
        rmdir "$from" 2> /dev/null || true
        if [ -d "$from" ]; then
                mkdir -p "$to"
-               cp -fpPR -t "$to" "$from"/*
+               cp -fpPR "$from"/* "$to"
        fi
 }
 
@@ -191,6 +197,10 @@ autotools_stage_all() {
                autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${layout_base_bindir}
                autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${layout_base_sbindir}
                autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${layout_libexecdir}
+               if [ "${prefix}/lib" != "${libdir}" ]; then
+                       # python puts its files in here, make sure they are staged as well
+                       autotools_stage_dir ${STAGE_TEMP}/${prefix}/lib ${STAGING_DIR_HOST}${layout_prefix}/lib
+               fi
        fi
        if [ -d ${STAGE_TEMP}/${libdir} ]
        then
@@ -199,20 +209,31 @@ autotools_stage_all() {
                las=$(find . -name \*.la -type f)
                cd $olddir
                echo "Found la files: $las"              
-               if [ -n "$las" ]; then
-                       # If there are .la files then libtool was used in the
-                       # build, so install them with magic mangling.
-                       for i in $las
-                       do
-                               dir=$(dirname $i)
-                               echo "oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}"
-                               oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}
-                       done
-               else
-                       # Otherwise libtool wasn't used, and lib/ can be copied
-                       # directly.
-                       echo "cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR}"
-                       cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR}
+               for i in $las
+               do
+                       sed -e 's/^installed=yes$/installed=no/' \
+                           -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*.la\),${STAGING_LIBDIR}/\1,g' \
+                           -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR},g' \
+                           -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
+                           -i ${STAGE_TEMP}/${libdir}/$i
+               done
+               autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR}
+       fi
+       # Ok, this is nasty. pkgconfig.bbclass is usually used to install .pc files,
+       # however some packages rely on the presence of .pc files to enable/disable
+       # their configurataions in which case we better should not install everything
+       # unconditionally, but rather depend on the actual results of make install.
+       # The good news though: a) there are not many packages doing this and
+       # b) packaged staging will fix that anyways. :M:
+       if [ "${AUTOTOOLS_STAGE_PKGCONFIG}" = "1" ]
+       then
+               if [ -e ${STAGE_TEMP}/${libdir}/pkgconfig/ ] ; then
+                       echo "cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/"
+                       cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/
+               fi
+               if [ -e ${STAGE_TEMP}/${datadir}/pkgconfig/ ] ; then
+                       echo "cp -f ${STAGE_TEMP}/${datadir}/pkgconfig/*.pc ${STAGING_DATADIR}/pkgconfig/"
+                       cp -f ${STAGE_TEMP}/${datadir}/pkgconfig/*.pc ${STAGING_DATADIR}/pkgconfig/
                fi
        fi
        rm -rf ${STAGE_TEMP}/${mandir} || true
@@ -222,3 +243,4 @@ autotools_stage_all() {
 }
 
 EXPORT_FUNCTIONS do_configure do_install
+