Enhancement: Fixes #197, Packaging port for Red Hat and derivatives (eg. Fedora)

This commit is contained in:
Rory Fewell
2024-04-11 22:38:25 +01:00
parent 0b4ead9921
commit 8224319135
10 changed files with 139 additions and 2 deletions

1
.gitignore vendored
View File

@@ -25,3 +25,4 @@ resources.c
*.pkg
*.pkg.tar.zst
*.pot
*.rpm

View File

@@ -14,6 +14,8 @@ The contents of this directory is as follows:
`deb/` - Debian (`.deb`) packaging implementation
`rpm/` - Red Hat (`.rpm`) packaging implementation
`build.sh` - build script for compiling a single component
`buildall.sh` - build script for compiling and packaging all components in the project
@@ -41,5 +43,6 @@ Supported distros/package formats:
- Arch Linux (`.pkg.tar.zst`)
- Debian (`.deb`)
- FreeBSD (`.pkg`)
- Red Hat (`.rpm`)
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

@@ -34,7 +34,7 @@ do_packaging()
# Build package now
#
(cd "${pkg_dir}/usr/local" && find -L . -type f) | sed 's/\.\///' > plist
(cd "${pkg_dir}/usr/local" && find . -type f,l) | sed 's/\.\///' > plist
pkg create -M manifest -r "${pkg_dir}" -p plist
cd "${CURDIR}"

View File

@@ -173,6 +173,9 @@ check_deps()
deb)
dpkg -s "${pkg_name}" >/dev/null 2>&1
;;
rpm)
rpm --query "${pkg_name}" >/dev/null 2>&1
;;
*)
echo "Package format not implemented!"
exit 1

View File

@@ -142,6 +142,7 @@ set(WINTC_ALPINE_APKBUILD_IN_PATH ${CMAKE_CURRENT_LIST_DIR}/APKBUILD.in)
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)
function(wintc_configure_and_install_packaging)
# Provide 'ALT_PROJECT_NAME' - basically some distros skip the 'lib' in
@@ -299,6 +300,31 @@ 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")
if (${PROJECT_FREESTATUS})
set(RPM_LICENCE GPLv2)
else()
set(RPM_LICENCE NonFree) # Do not know if correct, sod it
endif()
if (${PROJECT_ANYARCH})
set(RPM_ARCHITECTURE noarch)
else()
set(RPM_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif()
# Map dependencies to RPM
#
wintc_map_dependencies()
if (DEFINED DEPENDENCIES_MAP)
list(JOIN DEPENDENCIES_MAP " " RPM_REQUIRES)
string(PREPEND RPM_REQUIRES "Requires: ")
endif()
configure_file(${WINTC_RPM_SPEC_IN_PATH} rpm.spec @ONLY)
else()
message(
FATAL_ERROR

View File

@@ -0,0 +1,19 @@
Name: @ALT_PROJECT_NAME@
Version: @PROJECT_VERSION@
Release: 1
Summary: @PROJECT_DESCRIPTION@
BuildArch: @RPM_ARCHITECTURE@
License: @RPM_LICENCE@
@RPM_REQUIRES@
URL: https://github.com/rozniak/xfce-winxp-tc
BugURL: https://github.com/rozniak/xfce-winxp-tc/issues
%description
@PROJECT_DESCRIPTION@
%install
cd $TRUE_BUILD_ROOT
%make_install
(cd %{buildroot} && find . -type f,l) | sed 's/\.//' | sed 's/\ /\\ /g' > %{_builddir}/files
%files -f files

View File

@@ -53,6 +53,16 @@ then
exit 0
fi
# Check Red Hat
#
which rpm >/dev/null 2>&1
if [[ $? -eq 0 ]]
then
echo -n "rpm"
exit 0
fi
# Check Debian
#
which dpkg >/dev/null 2>&1

43
packaging/rpm/pkgimpl.sh Normal file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
#
# pkgimpl.sh - Packaging Implementation (Red Hat)
#
# 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()
{
# Build the package now
#
cd "${full_component_dir}"
rpmdev-setuptree
TRUE_BUILD_ROOT="${full_component_dir}" rpmbuild -ba rpm.spec
pkg_res=$?
cd "${CURDIR}"
if [[ $pkg_res -gt 0 ]]
then
echo "Package build failure!"
exit 1
fi
# Move package to output
#
clean_pkg_name=`cat ${full_component_dir}/rpm.spec | grep 'Name:' | cut -d':' -f2 | xargs echo -n`
find "${HOME}/rpmbuild/RPMS" -name "${clean_pkg_name}*.rpm" -exec mv '{}' "${OPT_OUTPUT_DIR}/${clean_pkg_name}.rpm" \;
echo "Packaged ${clean_pkg_name}"
}

View File

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

View File

@@ -0,0 +1,32 @@
garcon-->bt-->garcon-devel
garcon-->rt-->garcon
garcon-gtk3-->bt-->garcon-devel
garcon-gtk3-->rt-->garcon
gdk-pixbuf2-->bt-->gdk-pixbuf2-devel
gdk-pixbuf2-->rt-->gdk-pixbuf2
glib2-->bt-->glib2-devel
glib2-->rt-->glib2
gtk3-->bt-->gtk3-devel
gtk3-->rt-->gtk3
lightdm-->bt-->lightdm-gobject-devel
lightdm-->rt-->lightdm-gobject
msgfmt-->bt,rt-->gettext
plymouth-->bt,rt-->plymouth
pulseaudio-->bt-->pulseaudio-libs-devel
pulseaudio-->rt-->pulseaudio-libs
python3-venv-->bt,rt-->python3-virtualenv
sass-->bt,rt-->rubygem-sass
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-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