Enhancement: Fixes #293, Packaging port for Void Linux

This commit is contained in:
Rory Fewell
2024-05-23 19:10:04 +01:00
parent 021f624baf
commit 2feec2c3de
11 changed files with 215 additions and 29 deletions

View File

@@ -16,6 +16,8 @@ The contents of this directory is as follows:
`rpm/` - Red Hat (`.rpm`) packaging implementation
`xbps/` - Void Linux (`.xbps`) packaging implementation
`build.sh` - build script for compiling a single component
`buildall.sh` - build script for compiling and packaging all components in the project
@@ -44,5 +46,6 @@ Supported distros/package formats:
- Debian (`.deb`)
- FreeBSD (`.pkg`)
- Red Hat (`.rpm`)
- Void Linux (`.xbps`)
Please check under the `packaging` tag to see if there is an open issue for your favourite distro/package format. You can help speed up the process by providing a simple example package script or TL;DR so that the porting process is easier (I'm not familiar with every distro out there!)

View File

@@ -95,16 +95,17 @@ fi
# Identify distro build
#
dist_id=`"${SH_DISTID}"`
dist_prefix="/usr"
. "${SH_DISTID}"
if [[ $? -gt 0 ]]
then
"Failed to identify distribution."
exit 1
fi
case "${dist_id}" in
case "${DIST_ID}" in
bsdpkg)
dist_prefix="/usr/local"
;;
@@ -134,7 +135,8 @@ cmake -DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE="${OPT_BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${dist_prefix}" \
-DWINTC_SKU="${OPT_SKU}" \
-DWINTC_PKGMGR="${dist_id}" \
-DWINTC_PKGMGR="${DIST_ID}" \
-DWINTC_PKGMGR_EXT="${DIST_ID_EXT}" \
-DWINTC_USE_LOCAL_LIBS="${OPT_USE_LOCAL_LIBS}" \
-DWINTC_LOCAL_LIBS_ROOT="${OPT_BUILD_ROOT}" \
"${full_component_dir}"

View File

@@ -201,7 +201,7 @@ fi
# Identify our distro
#
dist_id=`${SH_DISTID}`
. "${SH_DISTID}"
if [[ $? -gt 0 ]]
then
@@ -222,7 +222,7 @@ then
build_type="checked"
fi
echo "Doing full system build for ${tag} (${cur_arch}, ${dist_id}) (${build_type})"
echo "Doing full system build for ${tag} (${cur_arch}, ${DIST_ID}-${DIST_ID_EXT}) (${build_type})"
# Handle output dir for packaging
#
@@ -230,7 +230,7 @@ if [[ $OPT_SKIP_PACKAGING -eq 0 ]]
then
if [[ "${OPT_OUTPUT_DIR}" == "" ]]
then
OPT_OUTPUT_DIR="${CURDIR}/xptc/${tag}/${dist_id}/${cur_arch}/${build_subdir}"
OPT_OUTPUT_DIR="${CURDIR}/xptc/${tag}/${DIST_ID}/${DIST_ID_EXT}/${cur_arch}/${build_subdir}"
mkdir -p "${OPT_OUTPUT_DIR}"
fi

View File

@@ -73,7 +73,7 @@ check_deps()
fi
local required_deps
required_deps=`python3 ${DEPMAP_PY} ${full_deps_path} ${dist_id}`
required_deps=`python3 ${DEPMAP_PY} ${full_deps_path} ${DIST_ID}`
if [[ $? -gt 0 ]]
then
@@ -119,7 +119,7 @@ check_deps()
# If there are alternatives available, check which one is available
# for this distro
#
case "${dist_id}" in
case "${DIST_ID}" in
deb)
local found_pkg=0
@@ -160,7 +160,7 @@ check_deps()
# It's a new dep, check whether it is already installed
#
case "${dist_id}" in
case "${DIST_ID}" in
apk)
apk info --installed "${pkg_name}" >/dev/null 2>&1
;;
@@ -176,6 +176,9 @@ check_deps()
rpm)
rpm --query "${pkg_name}" >/dev/null 2>&1
;;
xbps)
xbps-query --show "${pkg_name}" >/dev/null 2>&1
;;
*)
echo "Package format not implemented!"
exit 1
@@ -214,7 +217,7 @@ fi
# Identify our distro
#
dist_id=`"${SH_DISTID}"`
. "${SH_DISTID}"
if [[ $? -gt 0 ]]
then

View File

@@ -48,7 +48,8 @@ endif()
if (
${WINTC_PKGMGR} STREQUAL "apk" OR
${WINTC_PKGMGR} STREQUAL "archpkg" OR
${WINTC_PKGMGR} STREQUAL "bsdpkg"
${WINTC_PKGMGR} STREQUAL "bsdpkg" OR
${WINTC_PKGMGR} STREQUAL "xbps"
)
# No lib64 on some distros
#
@@ -82,7 +83,8 @@ endif()
#
if (
${WINTC_PKGMGR} STREQUAL "apk" OR
${WINTC_PKGMGR} STREQUAL "archpkg"
${WINTC_PKGMGR} STREQUAL "archpkg" OR
${WINTC_PKGMGR} STREQUAL "xbps"
)
set(WINTC_SAFE_SBIN_DIR ${CMAKE_INSTALL_BINDIR})
else()
@@ -94,7 +96,7 @@ endif()
if (${WINTC_PKGMGR} STREQUAL "bsdpkg")
set(WINTC_SAFE_PKGCONFIG_DIR libdata)
else()
set(WINTC_SAFE_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR})
set(WINTC_SAFE_PKGCONFIG_DIR ${LIB_DIR})
endif()
# Define dependency mapping function
@@ -147,6 +149,7 @@ set(WINTC_ARCH_PKGBUILD_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/PKGBUILD.in)
set(WINTC_BSD_MANIFEST_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/bsd-manifest.in)
set(WINTC_DEBIAN_CONTROL_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/debian-control.in)
set(WINTC_RPM_SPEC_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/rpm.spec.in)
set(WINTC_XBPS_VARS_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/xbps-vars.sh.in)
function(wintc_configure_and_install_packaging)
# Provide 'ALT_PROJECT_NAME' - basically some distros skip the 'lib' in
@@ -305,7 +308,7 @@ function(wintc_configure_and_install_packaging)
configure_file(${WINTC_DEBIAN_CONTROL_IN_PATH} control @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/control DESTINATION ${DESTDIR}/DEBIAN)
elseif (${WINTC_PKGMGR} STREQUAL "rpm")
message(STATUS "Outputting build Red Hat packaging")
message(STATUS "Outputting build for Red Hat packaging")
if (${PROJECT_FREESTATUS})
set(RPM_LICENCE GPLv2)
@@ -329,6 +332,51 @@ function(wintc_configure_and_install_packaging)
endif()
configure_file(${WINTC_RPM_SPEC_IN_PATH} rpm.spec @ONLY)
elseif(${WINTC_PKGMGR} STREQUAL "xbps")
message(STATUS "Outputting build for Void Linux packaging")
if (${PROJECT_FREESTATUS})
set(XBPS_LICENCE GPL-2.0-or-later)
else()
set(XBPS_LICENCE nonfree) # Again, could be bollocks
endif()
if (${PROJECT_ANYARCH})
set(XBPS_ARCHITECTURE noarch)
else()
if (${WINTC_PKGMGR_EXT} STREQUAL "musl")
set(XBPS_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}-musl)
else()
set(XBPS_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()
# Map dependencies to XBPS
#
wintc_map_dependencies()
if (DEFINED DEPENDENCIES_MAP)
# HACK: This transform here is a horrible bodge that would probably
# get me hung, drawn and quartered by Void Linux packagers if
# they ever came across it
#
# The repo currently doesn't track specific versions for deps
# so in order for Void Linux to be happy, we specify
# foo>=0.1_1
# which gets the job done, though obviously this is a totally
# scumbag thing to do
#
# FIXME: Probably should actually track minimum dep versions, since
# the packaging doesn't bother with versions for any other
# format either, not just Void
#
list(TRANSFORM DEPENDENCIES_MAP APPEND ">=0.1_1")
list(JOIN DEPENDENCIES_MAP " " XBPS_DEPENDENCIES)
else()
set(XBPS_DEPENDENCIES "")
endif()
configure_file(${WINTC_XBPS_VARS_IN_PATH} xbps-vars.sh @ONLY)
else()
message(
FATAL_ERROR

View File

@@ -0,0 +1,8 @@
#!/bin/bash
export XBPS_ARCH="@XBPS_ARCHITECTURE@"
export XBPS_DEPENDENCIES="@XBPS_DEPENDENCIES@"
export XBPS_DESC="@PROJECT_DESCRIPTION@"
export XBPS_LICENSE="@XBPS_LICENCE@"
export XBPS_MAINTAINER="@PROJECT_MAINTAINER@"
export XBPS_PKGVER="@ALT_PROJECT_NAME@-@PROJECT_VERSION@_1"

View File

@@ -29,8 +29,9 @@ which pacman >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "archpkg"
exit 0
export DIST_ID="archpkg"
export DIST_ID_EXT="std"
return 0
fi
# Check Alpine Linux
@@ -39,8 +40,9 @@ which apk >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "apk"
exit 0
export DIST_ID="apk"
export DIST_ID_EXT="std"
return 0
fi
# Check FreeBSD
@@ -49,8 +51,9 @@ which pkg >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "bsdpkg"
exit 0
export DIST_ID="bsdpkg"
export DIST_ID_EXT="std"
return 0
fi
# Check Red Hat
@@ -59,8 +62,33 @@ which rpm >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "rpm"
exit 0
export DIST_ID="rpm"
export DIST_ID_EXT="std"
return 0
fi
# Check Void Linux
#
which xbps-create >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
export DIST_ID="xbps"
# This might be a rubbish way to determine glibc vs. musl, if it does suck
# then someone needs to whinge and then I'll have to come up with something
# better
#
find /usr/lib -iname "*ld-musl*" | read
if [[ $? -eq 0 ]]
then
export DIST_ID_EXT="musl"
else
export DIST_ID_EXT="glibc"
fi
return 0
fi
# Check Debian
@@ -69,11 +97,12 @@ which dpkg >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "deb"
exit 0
export DIST_ID="deb"
export DIST_ID_EXT="std"
return 0
fi
# Nothing else to probe, it's over!
#
echo "Unsupported distribution."
exit 1
return 1

View File

@@ -85,7 +85,7 @@ fi
# Identify our distro
#
dist_id=`${SH_DISTID}`
. "${SH_DISTID}"
if [[ $? -gt 0 ]]
then
@@ -95,11 +95,11 @@ fi
# Ensure packaging implementation available
#
sh_pkg_impl="${SCRIPTDIR}/${dist_id}/pkgimpl.sh"
sh_pkg_impl="${SCRIPTDIR}/${DIST_ID}/pkgimpl.sh"
if [[ ! -f "${sh_pkg_impl}" ]]
then
echo "Packaging implementation for ${dist_id} not found!"
echo "Packaging implementation for ${DIST_ID} not found!"
exit 1
fi

57
packaging/xbps/pkgimpl.sh Normal file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
#
# pkgimpl.sh - Packaging Implementation (Void Linux)
#
# This source-code is part of Windows XP stuff for XFCE:
# <<https://www.oddmatics.uk>>
#
# Author(s): Rory Fewell <roryf@oddmatics.uk>
#
#
# FUNCTIONS
#
do_packaging()
{
pkg_dir="${full_component_dir}/out"
# Assemble package
#
cd "${full_component_dir}"
make install DESTDIR="${pkg_dir}"
ass_res=$?
cd "${CURDIR}"
if [[ $ass_res -gt 0 ]]
then
echo "Package assembly failure!"
exit 1
fi
# Build package now
#
. "${full_component_dir}/xbps-vars.sh"
xbps-create --architecture "${XBPS_ARCH}" \
--dependencies "${XBPS_DEPENDENCIES}" \
--desc "${XBPS_DESC}" \
--homepage "https://github.com/rozniak/xfce-winxp-tc" \
--license "${XBPS_LICENSE}" \
--maintainer "${XBPS_MAINTAINER}" \
--pkgver "${XBPS_PKGVER}" \
"${pkg_dir}"
# Move package to output
#
find "${CURDIR}" -maxdepth 1 \
-type f \
-iname "${XBPS_PKGVER}*.xbps" \
-exec mv '{}' "${OPT_OUTPUT_DIR}" \;
echo "Packaged ${XBPS_PKGVER}"
}

View File

@@ -3,7 +3,7 @@ import argparse
from pathlib import Path
def main():
VALID_DISTROS=["apk", "archpkg", "bsdpkg", "deb", "rpm"]
VALID_DISTROS=["apk", "archpkg", "bsdpkg", "deb", "rpm", "xbps"]
parser = argparse.ArgumentParser(
prog="Dependency Mapper Utility",

View File

@@ -0,0 +1,36 @@
garcon-->bt-->garcon-devel
garcon-->rt-->garcon
garcon-gtk3-->bt-->garcon-devel
garcon-gtk3-->rt-->garcon
gdk-pixbuf2-->bt-->gdk-pixbuf-devel
gdk-pixbuf2-->rt-->gdk-pixbuf
glib2-->bt-->glib-devel
glib2-->rt-->glib
gtk3-->bt-->gtk+3-devel
gtk3-->rt-->gtk+3
lightdm-->bt-->lightdm-devel
lightdm-->rt-->liblightdm-gobject
msgfmt-->bt,rt-->gettext
plymouth-->bt,rt-->plymouth
pulseaudio-->bt-->pulseaudio-devel
pulseaudio-->rt-->pulseaudio
python3-packaging-->bt,rt-->python3-packaging
python3-venv-->bt,rt-->python3-virtualenv
sass-->bt,rt-->sassc
sqlite3-->bt-->sqlite-devel
sqlite3-->rt-->sqlite
sysinfo-->bt,rt-->NULL
wintc-comctl-->bt,rt-->wintc-comctl
wintc-comgtk-->bt,rt-->wintc-comgtk
wintc-exec-->bt,rt-->wintc-exec
wintc-msgina-->bt,rt-->wintc-msgina
wintc-registry-->bt,rt-->wintc-registry
wintc-shcommon-->bt,rt-->wintc-shcommon
wintc-shell-->bt,rt-->wintc-shell
wintc-shelldpa-->bt,rt-->wintc-shelldpa
wintc-shellext-->bt,rt-->wintc-shellext
wintc-shlang-->bt,rt-->wintc-shlang
wintc-sndapi-->bt,rt-->wintc-sndapi
wintc-winbrand-->bt,rt-->wintc-winbrand
xcursorgen-->bt,rt-->xcursorgen
xdg-mime-->bt,rt-->xdg-utils