name=pkg-config
from_source=pkg-config
revision=1
imagedeps="gcc"
hostdeps="automake autoconf libtool"

build() {
    "${source_dir}"/configure \
        --prefix="${prefix}"

    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install
    mkdir -p "${dest_dir}${prefix}/share/pkgconfig/personality.d"
    cat <<EOF >"${dest_dir}${prefix}/share/pkgconfig/personality.d/${OS_TRIPLET}.personality"
Triplet: ${OS_TRIPLET}
SysrootDir: ${sysroot_dir}
DefaultSearchPaths: ${sysroot_dir}/usr/lib/pkgconfig:${sysroot_dir}/usr/share/pkgconfig
SystemIncludePaths: ${sysroot_dir}/usr/include
SystemLibraryPaths: ${sysroot_dir}/usr/lib
EOF
    ln -s pkgconf "${dest_dir}${prefix}/bin/${OS_TRIPLET}-pkg-config"

        strip_command=strip \
    post_package_strip
}
