Merge branch 'org.openembedded.dev' of git://git.openembedded.org/openembedded into...
[vuplus_openembedded] / classes / autotools.bbclass
index 7a87cc0..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"
@@ -165,6 +171,17 @@ autotools_stage_includes() {
        fi
 }
 
+autotools_stage_dir() {
+       from="$1"
+       to="$2"
+       # This will remove empty directories so we can ignore them
+       rmdir "$from" 2> /dev/null || true
+       if [ -d "$from" ]; then
+               mkdir -p "$to"
+               cp -fpPR "$from"/* "$to"
+       fi
+}
+
 autotools_stage_all() {
        if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
        then
@@ -173,9 +190,17 @@ autotools_stage_all() {
        rm -rf ${STAGE_TEMP}
        mkdir -p ${STAGE_TEMP}
        oe_runmake DESTDIR="${STAGE_TEMP}" install
-       if [ -d ${STAGE_TEMP}/${includedir} ]; then
-               mkdir -p ${STAGING_INCDIR}
-               cp -fpPR -t ${STAGING_INCDIR} ${STAGE_TEMP}/${includedir}/*
+       autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR}
+       if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
+               autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${layout_bindir}
+               autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${layout_sbindir}
+               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
@@ -184,27 +209,38 @@ 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}
-               fi
+               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
-       if [ -d ${STAGE_TEMP}/${datadir}/aclocal ]; then
-               install -d ${STAGING_DATADIR}/aclocal
-               cp -fpPR ${STAGE_TEMP}/${datadir}/aclocal/* ${STAGING_DATADIR}/aclocal
+       # 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
+       rm -rf ${STAGE_TEMP}/${infodir} || true
+       autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR}
        rm -rf ${STAGE_TEMP}
 }
 
 EXPORT_FUNCTIONS do_configure do_install
+