Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xbps-src: declarative split library and development file #21721

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 73 additions & 0 deletions common/environment/setup/vsplit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Helper function to split library & development files

vsplit_lib() {
# libpkg and lib_short_desc will be reused for devel package
libpkg="${1:-lib${pkgname}}"
lib_short_desc="${2:-$short_desc - runtime library}"
local _lib_depends_line _lib_shlib_line
if [ -n "$3" ]; then
_lib_depends_line="depends='$3'"
fi
if [ -n "$lib_shlib_provides" ]; then
_lib_shlib_line="shlib_provides='$lib_shlib_provides'"
fi
eval "
${libpkg}_package() {
$_lib_depends_line
$_lib_shlib_line
short_desc='${lib_short_desc}'
pkg_install() {
vmove 'usr/lib/*.so.*'
if command -v lib_post_install >/dev/null 2>&1; then
lib_post_install
fi
if command -v ${libpkg}_post_install >/dev/null 2>&1; then
${libpkg}_post_install
fi
}
}
"
}

vsplit_devel() {
local _basepkg="${libpkg:-${pkgname}}"
local _develpkg="${1:-${_basepkg}-devel}"
local _base_short_desc="${lib_short_desc:-$short_desc}"
local _devel_short_desc="${2:-${_base_short_desc} - development files}"
local _devel_depends="${3:-$makedepends ${_basepkg}>=${version}_${revision}}"
eval "
${_develpkg}_package() {
depends='$_devel_depends'
short_desc='${devel_short_desc:-${_base_short_desc} - development files}'
pkg_install() {
for d in usr/include \\
usr/lib/pkgconfig usr/share/pkgconfig \\
usr/share/vala usr/share/gir-1.0 \\
usr/share/man/man2 usr/share/man/man3 \\
usr/share/aclocal usr/share/sgml \\
usr/share/cmake usr/lib/cmake \\
usr/share/gtk-doc usr/lib/qt5/mkspecs
do
if [ -d \"\$DESTDIR/\$d\" ]; then
vmove \"\$d\"
fi
done
for f in \"\$DESTDIR/usr/lib/\"*.so \\
\"\$DESTDIR/usr/lib/\"*.a \\
\"\$DESTDIR/usr/bin/\"*-config \\
\"\$DESTDIR/usr/share/man/man1/\"*-config.1*
do
if [ -f \"\$f\" ]; then
vmove \"\${f#\$DESTDIR}\"
fi
done
if command -v devel_post_install >/dev/null 2>&1; then
devel_post_install
fi
if command -v ${_develpkg}_post_install >/dev/null 2>&1; then
${_develpkg}_post_install
fi
}
}
"
}
8 changes: 6 additions & 2 deletions common/hooks/do-pkg/00-gen-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ hook() {
fi
done
if [ -z "$found_dbg_subpkg" -a -d "${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}" ]; then
source ${XBPS_COMMONDIR}/environment/setup-subpkg/subpkg.sh
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
repo=$XBPS_REPOSITORY/debug
_pkgver=${pkgname}-dbg-${version}_${revision}
_desc="${short_desc} (debug files)"
Expand All @@ -154,7 +156,9 @@ hook() {
return
fi
if [ -d "${XBPS_DESTDIR}/${pkgname}-32bit-${version}" ]; then
source ${XBPS_COMMONDIR}/environment/setup-subpkg/subpkg.sh
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
if [ -n "$repository" ]; then
repo=$XBPS_REPOSITORY/multilib/$repository
else
Expand Down
26 changes: 5 additions & 21 deletions srcpkgs/curl/template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ changelog="https://curl.haxx.se/changes.html#${version//./_}"
distfiles="${homepage}/download/${pkgname}-${version}.tar.bz2"
checksum=a50bfe62ad67a24f8b12dd7fd655ac43a0f0299f86ec45b11354f25fbb5829d0
patch_args="-Np1"
lib_shlib_provides="libcurl-gnutls.so.4"
build_options="gnutls gssapi ldap rtmp ssh ssl"
build_options_default="ssh ssl"
vopt_conflict ssl gnutls
Expand All @@ -36,26 +37,9 @@ post_install() {
vlicense COPYING
}

libcurl_package() {
short_desc="Multiprotocol file transfer library"
shlib_provides="libcurl-gnutls.so.4"
pkg_install() {
vmove "usr/lib/*.so.*"
ln -sf libcurl.so.4.6.0 ${PKGDESTDIR}/usr/lib/libcurl-gnutls.so.4
}
lib_post_install() {
ln -sf libcurl.so.4.6.0 ${PKGDESTDIR}/usr/lib/libcurl-gnutls.so.4
}

libcurl-devel_package() {
depends="${makedepends} libcurl>=${version}_${revision}"
short_desc="Multiprotocol file transfer library - development files"
pkg_install() {
vmove usr/bin/curl-config
vmove "usr/share/man/man1/curl-config*"
vmove usr/share/man/man3
vmove usr/share/aclocal
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove usr/lib/pkgconfig
}
}
vsplit_lib "" "Multiprotocol file transfer library"
vsplit_devel
11 changes: 1 addition & 10 deletions srcpkgs/libuv/template
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,4 @@ post_install() {
vlicense LICENSE
}

libuv-devel_package() {
depends="libuv>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}
vsplit_devel
17 changes: 2 additions & 15 deletions srcpkgs/notmuch/template
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,8 @@ post_install() {
rm -f ${DESTDIR}/usr/share/applications/mimeinfo.cache
}

libnotmuch_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove usr/lib/*.so.*
}
}

libnotmuch-devel_package() {
short_desc+=" - development files"
depends="libnotmuch-${version}_${revision}"
pkg_install() {
vmove usr/include
vmove usr/lib/*.so
}
}
vsplit_lib
vsplit_devel "" "" "libnotmuch-${version}_${revision}"

notmuch-emacs_package() {
archs=noarch
Expand Down