Skip to content
This repository was archived by the owner on Nov 16, 2025. It is now read-only.

Commit d9a3b81

Browse files
authored
Building RPM installation package for Fedora 41+ (#147)
Provide the artifacts needed and instructions for building RPM installation packages for Fedora 41+
1 parent a704302 commit d9a3b81

11 files changed

Lines changed: 661 additions & 0 deletions

build/fedora/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Building transgui for Fedora 41+
2+
3+
I have created an installation RPM package for [lighterowl's fork of transgui](https://github.com/lighterowl/transgui) in my [Fedora Copr repository](https://copr.fedorainfracloud.org/coprs/dlk/transgui/). If all you want to do is to install transgui on Fedora 41, 42, or rawhide, you can do that using these commands:
4+
5+
sudo dnf copr enable dlk/transgui
6+
sudo dnf install transgui
7+
8+
## How I built transgui in Copr
9+
10+
Building this version of transgui requires development versions of the Free Pascal Compiler and its IDE tool Lazarus. As far as I can tell, RPMs for the development versions of these applications are not available anywhere else. RPMs for them must be built first, and then be made available as dependencies during the transgui Copr build.
11+
12+
The following sections describe how I built the transgui RPM package on Copr.
13+
14+
### Create two Copr projects, transgui and transgui-sdk
15+
16+
If you do not already have [copr-cli set up on your workstation](https://developer.fedoraproject.org/deployment/copr/copr-cli.html) you'll have to do that first. When that is set up, then you can create the two new projects in Copr. That can be done via the Copr web interface or by entering these commands. (Substitute your Copr userid for "${USERID}" in the commands.)
17+
18+
copr-cli create --chroot fedora-41-x86_64 --chroot fedora-42-x86_64 --chroot fedora-rawhide-x86_64 transgui-sdk
19+
copr-cli modify --repo "copr://${USERID}/transgui-sdk" transgui-sdk
20+
copr-cli create --repo "copr://${USERID}/transgui-sdk" --chroot fedora-41-x86_64 --chroot fedora-42-x86_64 --chroot fedora-rawhide-x86_64 transgui
21+
22+
### Build fpc and lazarus in the transgui-sdk project repository
23+
24+
I have provided two scripts that demonstrate how to do this, **copr-build-fpc** and **copr-build-lazarus**
25+
26+
The **copr-build-fpc** script must be run first and complete successfully before the **copr-build-lazarus** script can be run. Lazarus needs to be compiled using the version of fpc that is built in the **fpc** package.
27+
28+
### Build transgui in the transgui project repository
29+
30+
After the **fpc** and **lazarus** packages are ready in the transgui-sdk repository, then the **copr-build-transgui** script can be run to create the **transgui** package in the transgui project repository.
31+
32+
## How to build your own Fedora package by hand
33+
34+
I have provided a script called **build-transgui** that will perform the steps necessary to build an RPM for transgui in a podman (Docker) container on a Fedora system. This script demonstrates the manual steps necessary to build an installation RPM.

build/fedora/build-transgui

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2025 David King <dave@daveking.com>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License,
7+
# version 2, as published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License,
15+
# version 2, along with this program; if not, see
16+
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.
17+
#################################################################################
18+
#
19+
# This script builds the RPM package for lighterowl's fork of the transgui
20+
# (Transmission Remote GUI) application - https://github.com/lighterowl/transgui
21+
# - in a podman container that it creates.
22+
#
23+
# The build requires development versions of fpc (the Free Pascal Compiler) and
24+
# its Lazarus IDE. This script compiles and installs these in the container
25+
# before building the transgui package.
26+
#
27+
# The output of this script ia an installation RPM file for transgui, located
28+
# in the $RPM_OUTPUT_DIR subdirectory.
29+
#
30+
#################################################################################
31+
32+
# This URL points to my github.com fork of lighterowl's fork of transgui, where
33+
# I have posted a few additional assets that are used to build my transgui package
34+
FORK_URL="https://raw.githubusercontent.com/dlk3/transgui/refs/heads/copr/build/fedora"
35+
36+
CONTAINER_NAME="transgui-builder"
37+
BASE_IMAGE="fedora:41"
38+
RPM_OUTPUT_DIR=${HOME}/rpmbuild
39+
40+
# Terminate script immediately if/when an error occurs
41+
set -e
42+
43+
# Date/time format for console messages
44+
DATEFMT="+%Y-%m-%d %H:%M:%S"
45+
46+
# If the "-t" option is passed on the command line, the script will
47+
# build the podman container and open it to a shell prompt, without
48+
# doing the transgui build.
49+
TESTING="no"
50+
while getopts ":bth" OPT; do
51+
case "$OPT" in
52+
t)
53+
TESTING="YES"
54+
;;
55+
h)
56+
echo "usage: $0 [-h] [-t]"
57+
echo
58+
echo " Where:"
59+
echo " -h Show this help text"
60+
echo " -t Start the build container with a bash prompt for testing"
61+
exit
62+
;;
63+
*)
64+
echo "usage: $0 [-h] [-t]"
65+
exit 1
66+
esac
67+
done
68+
shift $((OPTIND-1))
69+
70+
# If we are not running inside the podman container, build the container and run the rpmbuild in it
71+
if [ "$container" != "oci" ]; then
72+
73+
echo "$(date "$DATEFMT"): Building the $CONTAINER_NAME image"
74+
75+
# Create the Dockerfile that will be used to build the container
76+
cat >/tmp/Dockerfile << __Dockerfile__
77+
FROM ${BASE_IMAGE}
78+
RUN dnf -y upgrade
79+
RUN dnf -y group install development-tools
80+
RUN dnf -y install rpmdevtools fpc glibc-devel qt5pas-devel libX11-devel gtk2-devel
81+
RUN rpmdev-setuptree
82+
__Dockerfile__
83+
84+
# Build the container image
85+
/usr/bin/podman build --tag=$CONTAINER_NAME /tmp
86+
rm /tmp/Dockerfile
87+
88+
if [ "$TESTING" == "YES" ]; then
89+
# Start the container with a bash prompt for testing
90+
/usr/bin/podman run --name=$CONTAINER_NAME -it --rm --env "TARGET_DIR=${RPM_OUTPUT_DIR}" --volume="$HOME":"$HOME" "localhost/$CONTAINER_NAME" /bin/bash
91+
exit
92+
else
93+
# Run this script inside the container to build the transgui RPM files
94+
echo "$(date "$DATEFMT"): Starting the $CONTAINER_NAME container"
95+
/usr/bin/podman run --name=$CONTAINER_NAME -it --rm --env "TARGET_DIR=${RPM_OUTPUT_DIR}" --volume="$HOME":"$HOME" "localhost/$CONTAINER_NAME" "$(realpath "$0")"
96+
echo "$(date "$DATEFMT"): Stopping the $CONTAINER_NAME container"
97+
fi
98+
99+
# When we are run inside the container, do the build
100+
else
101+
# If there are any errors while this script runs in the container, drop us
102+
# into a shell so that we can poke around before the container is destroyed
103+
function on_error()
104+
{
105+
echo
106+
echo "There has been an error in the $(basename "$0") script."
107+
echo "Please use this shell prompt to debug the problem."
108+
echo "When finished, use Ctrl-D to terminate the shell and remove the container."
109+
echo
110+
/bin/sh
111+
exit 1
112+
}
113+
trap on_error ERR
114+
115+
# Code stolen from https://github.com/lighterowl/transgui-sdk/blob/main/sdk_build.sh
116+
# to download and install the development versions of the Free Pascal Compiler and
117+
# Lazarus IDE
118+
SDK_DIR=${HOME}/.transgui_sdk
119+
FPC_INSTALLDIR="${SDK_DIR}/fpc-3.2.4-rc1"
120+
FPC_BASEPATH="${FPC_INSTALLDIR}/lib/fpc/3.2.4"
121+
LAZ_INSTALLDIR="${SDK_DIR}/lazarus-4.0.0"
122+
123+
mkdir -p ${SDK_DIR}
124+
cd ${SDK_DIR}
125+
126+
FPC324_RC1_COMMIT='56baf314b5ebf4e5a44fe3e214914fa2e1b34adb'
127+
curl -L -o fpc-src.tar.bz2 "https://gitlab.com/freepascal.org/fpc/source/-/archive/${FPC324_RC1_COMMIT}/source-${FPC324_RC1_COMMIT}.tar.bz2"
128+
tar xf fpc-src.tar.bz2
129+
mv "source-${FPC324_RC1_COMMIT}" fpc-src
130+
cd fpc-src
131+
132+
make all
133+
mkdir -p "${FPC_INSTALLDIR}"
134+
make PREFIX=$FPC_INSTALLDIR install
135+
dnf remove -y fpc
136+
137+
export PATH=${FPC_INSTALLDIR}/bin:${FPC_BASEPATH}:$PATH
138+
fpcmkcfg -d basepath=${FPC_BASEPATH} -o ${HOME}/.fpc.cfg
139+
echo "fpc version = $(fpc -iW)"
140+
141+
cd "$SDK_DIR"
142+
LAZARUS_COMMIT='cadda6230398688d6106fe37fb0673a9a2bf0cf3'
143+
curl -L -o lazarus-src.tar.bz2 "https://gitlab.com/dkk089/lazarus/-/archive/${LAZARUS_COMMIT}/lazarus-${LAZARUS_COMMIT}.tar.bz2"
144+
tar xf lazarus-src.tar.bz2
145+
mv "lazarus-${LAZARUS_COMMIT}" lazarus
146+
cd lazarus
147+
make bigide LCL_PLATFORM=qt5
148+
mkdir -p "${LAZ_INSTALLDIR}"
149+
make install INSTALL_PREFIX=$LAZ_INSTALLDIR
150+
151+
export PATH=${LAZ_INSTALLDIR}/lib64/lazarus:${LAZ_INSTALLDIR}/bin:$PATH
152+
echo "lazbuild version = $(lazbuild -v)"
153+
154+
cd "$SDK_DIR"
155+
rm *.tar.bz2
156+
## End of code theft
157+
158+
# Create the Lazarus config file
159+
mkdir /etc/lazarus
160+
sed "s#__LAZARUSDIR__#${LAZ_INSTALLDIR}/share/lazarus#;s#__FPCSRCDIR__#${FPC_INSTALLDIR}/lib64/fpc/3.2.4#" \
161+
${LAZ_INSTALLDIR}/share/lazarus/tools/install/linux/environmentoptions.xml \
162+
> /etc/lazarus/environmentoptions.xml
163+
164+
# Fetch the SPEC file from my fork of lighterowl's transgui repo
165+
curl -L -o ${HOME}/rpmbuild/SPECS/transgui.spec "${FORK_URL}/transgui.spec"
166+
167+
# Comment out the fpc and lazarus package BuildRequires in the SPEC file
168+
sed -i 's/\(^BuildRequires:.*fpc.*\)/# \1/' ${HOME}/rpmbuild/SPECS/transgui.spec
169+
sed -i 's/\(^BuildRequires:.*lazarus.*\)/# \1/' ${HOME}/rpmbuild/SPECS/transgui.spec
170+
# Make sure the rest of the BuildRequires get installed
171+
dnf -y install $(awk '/^BuildRequires:/ {printf "%s ",$2}' ${HOME}/rpmbuild/SPECS/transgui.spec)
172+
173+
# Fetch lighterowl's transgui source
174+
TRANSGUI_VERSION=$(awk '/^Version:/ {print $2}' ${HOME}/rpmbuild/SPECS/transgui.spec)
175+
mkdir ${HOME}/src
176+
cd ${HOME}/src
177+
git clone --depth 1 --branch v${TRANSGUI_VERSION} --recurse-submodules https://github.com/lighterowl/transgui.git transgui-${TRANSGUI_VERSION}
178+
179+
# Fetch the transgui.desktop file and transgui.png icon from my fork of
180+
# lighterowl's transgui repo
181+
curl -L -o transgui-${TRANSGUI_VERSION}/transgui.desktop "${FORK_URL}/transgui.desktop"
182+
curl -L -o transgui-${TRANSGUI_VERSION}/transgui.png "${FORK_URL}/transgui.png"
183+
184+
# Create the source tar.gz
185+
tar czf ${HOME}/rpmbuild/SOURCES/transgui-${TRANSGUI_VERSION}.tar.gz transgui-${TRANSGUI_VERSION}
186+
187+
# Build the package file
188+
echo "$(date "$DATEFMT"): Starting rpmbuild"
189+
rpmbuild -bb ${HOME}/rpmbuild/SPECS/transgui.spec
190+
echo "$(date "$DATEFMT"): rpmbuild complete"
191+
192+
# Copy the package file to the target directory
193+
echo "$(date "$DATEFMT"): Copying the RPM to ${TARGET_DIR}"
194+
mkdir -p ${TARGET_DIR}/RPMS
195+
cp -rv /root/rpmbuild/RPMS/* ${TARGET_DIR}/RPMS/
196+
fi

build/fedora/copr-build-fpc

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2025 David King <dave@daveking.com>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License,
7+
# version 2, as published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License,
15+
# version 2, along with this program; if not, see
16+
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.
17+
#################################################################################
18+
#
19+
# Assemble the source RPMs for the Free Pascal Compiler 3.2.4 and Lazarus 4.0.0
20+
# packages and submit them for building to my transgui-sdk COPR project ->
21+
# https://copr.fedorainfracloud.org/coprs/dlk/transgui-sdk/
22+
#
23+
# These development versions of these packages are needed to build lighterowl's
24+
# fork of transgui, as I have done in my transgui COPR project ->
25+
# https://copr.fedorainfracloud.org/coprs/dlk/transgui-sdk/
26+
#
27+
#################################################################################
28+
29+
set -e
30+
31+
FORKURL="https://raw.githubusercontent.com/dlk3/transgui/refs/heads/copr/build/fedora"
32+
33+
### FPC
34+
35+
echo "Fetching fpc.spec file"
36+
curl -L -o "${HOME}/rpmbuild/SPECS/fpc.spec" "${FORKURL}/fpc.spec"
37+
FPC_VERSION=$(awk '/^Version:/ {print $2}' ${HOME}/rpmbuild/SPECS/fpc.spec)
38+
39+
echo "Creating temporary working directory"
40+
TMPDIR="/tmp/fpc-rebuild"
41+
rm -fr "${TMPDIR}"
42+
mkdir "${TMPDIR}"
43+
44+
echo "Fetching the fpc source"
45+
FPC_COMMIT='56baf314b5ebf4e5a44fe3e214914fa2e1b34adb'
46+
curl -L -o "${TMPDIR}/fpc-src.tar.bz2" "https://gitlab.com/freepascal.org/fpc/source/-/archive/${FPC_COMMIT}/source-${FPC_COMMIT}.tar.bz2"
47+
48+
echo "Repackaging fpc source for RPM build"
49+
rm -f ${HOME}/rpmbuild/SOURCES/fpc-${FPC_VERSION}.tar.gz
50+
cd "${TMPDIR}"
51+
tar xf fpc-src.tar.bz2
52+
mv "source-${FPC_COMMIT}" fpc-${FPC_VERSION}
53+
54+
#echo "Adding my customizations"
55+
#curl -L -o "fpc-${FPC_VERSION}/fpc-path.sh" "${FORKURL}/fpc-path.sh"
56+
57+
echo "Creating source tar file"
58+
tar czf ${HOME}/rpmbuild/SOURCES/fpc-${FPC_VERSION}.tar.gz fpc-${FPC_VERSION}
59+
60+
echo "Building the rpm"
61+
rm -f ${HOME}/rpmbuild/SRPMS/fpc-${FPC_VERSION}-*.src.rpm
62+
rm -f ${HOME}/rpmbuild/RPMS/x86_64/fpc-${FPC_VERSION}-*.src.rpm
63+
rpmbuild -bs ${HOME}/rpmbuild/SPECS/fpc.spec
64+
# Build locally for testing
65+
#rpmbuild -ba ${HOME}/rpmbuild/SPECS/fpc.spec
66+
67+
echo "Sending the src.rpm to COPR for building"
68+
copr-cli build transgui-sdk ${HOME}/rpmbuild/SRPMS/fpc-${FPC_VERSION}-*.src.rpm
69+

build/fedora/copr-build-lazarus

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2025 David King <dave@daveking.com>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License,
7+
# version 2, as published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License,
15+
# version 2, along with this program; if not, see
16+
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.
17+
#################################################################################
18+
#
19+
# Assemble the source RPMs for the Free Pascal Compiler 3.2.4 and Lazarus 4.0.0
20+
# packages and submit them for building to my transgui-sdk COPR project ->
21+
# https://copr.fedorainfracloud.org/coprs/dlk/transgui-sdk/
22+
#
23+
# These development versions of these packages are needed to build lighterowl's
24+
# fork of transgui, as I have done in my transgui COPR project ->
25+
# https://copr.fedorainfracloud.org/coprs/dlk/transgui-sdk/
26+
#
27+
#################################################################################
28+
29+
set -e
30+
31+
FORKURL="https://raw.githubusercontent.com/dlk3/transgui/refs/heads/copr/build/fedora"
32+
33+
echo "Fetching lazarus.spec file"
34+
curl -L -o "${HOME}/rpmbuild/SPECS/lazarus.spec" "${FORKURL}/lazarus.spec"
35+
LAZ_VERSION=$(awk '/^Version:/ {print $2}' ${HOME}/rpmbuild/SPECS/lazarus.spec)
36+
37+
echo "Creating temporary working directory"
38+
TMPDIR="/tmp/laz-rebuild"
39+
rm -fr "${TMPDIR}"
40+
mkdir "${TMPDIR}"
41+
42+
echo "Fetching the lazarus source"
43+
LAZ_COMMIT='cadda6230398688d6106fe37fb0673a9a2bf0cf3'
44+
curl -L -o "${TMPDIR}/lazarus-src.tar.bz2" "https://gitlab.com/dkk089/lazarus/-/archive/${LAZ_COMMIT}/lazarus-${LAZ_COMMIT}.tar.bz2"
45+
46+
echo "Repackaging lazarus source for RPM build"
47+
rm -f ${HOME}/rpmbuild/SOURCES/lazarus-${LAZ_VERSION}.tar.gz
48+
cd "${TMPDIR}"
49+
tar xf lazarus-src.tar.bz2
50+
mv "lazarus-${LAZ_COMMIT}" lazarus-${LAZ_VERSION}
51+
52+
echo "Creating source tar file"
53+
tar czf ${HOME}/rpmbuild/SOURCES/lazarus-${LAZ_VERSION}.tar.gz lazarus-${LAZ_VERSION}
54+
55+
echo "Building the src.rpm"
56+
rm -f ${HOME}/rpmbuild/SRPMS/lazarus-${LAZ_VERSION}-*.src.rpm
57+
rpmbuild -bs ${HOME}/rpmbuild/SPECS/lazarus.spec
58+
# Build locally for testing
59+
#rpmbuild -ba ${HOME}/rpmbuild/SPECS/lazarus.spec
60+
61+
echo "Sending the src.rpm to COPR for building"
62+
copr-cli build transgui-sdk ${HOME}/rpmbuild/SRPMS/lazarus-${LAZ_VERSION}-*.src.rpm
63+

0 commit comments

Comments
 (0)