Initial import from Fedora 40

Resolves: RHEL-37535
This commit is contained in:
Tomas Popela 2024-05-31 13:51:29 +02:00
parent 7dc77abe10
commit d2039f6a16
6 changed files with 388 additions and 0 deletions

2
distutils.cfg Normal file
View File

@ -0,0 +1,2 @@
[install]
prefix=/app

202
flatpak-rpm-macros.spec Normal file
View File

@ -0,0 +1,202 @@
Name: flatpak-rpm-macros
Version: 40
Release: 3%{?dist}
Summary: Macros for building RPMS for flatpaks
Source0: macros.flatpak.in
Source1: distutils.cfg
Source2: flatpak.xml
Source3: fontconfig-flatpak.prov
License: MIT
# Buildrequire these to satisfy Pyton byte-compilation hooks
BuildRequires: python3
%description
The macros in this package set up the RPM build environment so built
applications install in /app rather than /usr. This package is meant
only for installation in buildroots when rebuilding RPMS to package
in Flatpaks.
%prep
%build
sed -e 's|__LIB__|%{_lib}|g' \
%{SOURCE0} > macros.flatpak
%install
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
install -t $RPM_BUILD_ROOT%{_sysconfdir}/rpm -p -m 644 macros.flatpak
for v in 3.12 ; do
mkdir -p $RPM_BUILD_ROOT%{_libdir}/python$v/distutils/
install -t $RPM_BUILD_ROOT%{_libdir}/python$v/distutils/ %{SOURCE1}
done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xdg/xmvn/config.d
install -t $RPM_BUILD_ROOT%{_sysconfdir}/xdg/xmvn/config.d -m 644 %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}
install -t $RPM_BUILD_ROOT%{_rpmconfigdir} -m 755 %{SOURCE3}
%files
# The location in sysconfdir contradicts
# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros
# but I believe is necessary to properly override macros that are otherwise set.
%{_sysconfdir}/rpm/
%{_libdir}/python*/distutils/distutils.cfg
%{_sysconfdir}/xdg/xmvn/config.d/flatpak.xml
%{_rpmconfigdir}/fontconfig-flatpak.prov
%changelog
* Tue May 14 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 40-3
- Define pandoc_datadir
* Mon Apr 08 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 40-2
- Override jurand macros
* Wed Mar 27 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 40-1
- Version bump for F40
- Define JAVA_HOME, JAVACONFDIRS and %%__maven_path
- Change xmvn configuration location
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 39-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 39-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Aug 28 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 39-4
- Define %%_localstatedir and %%__git
* Tue Aug 22 2023 Owen Taylor <otaylor@redhat.com> - 39-3
- Fix %%dist tag to be consistent with fedora-release
* Mon Aug 7 2023 Owen Taylor <otaylor@redhat.com> - 39-2
- Bump release for rebuild
* Mon Aug 7 2023 Owen Taylor <otaylor@redhat.com> - 39-1
- Set %%dist to f%%{fedora}app - this is for building without modules
* Fri Aug 04 2023 Kalev Lember <klember@redhat.com> - 39-1
- Update %%python_sitearch for python-3.12 (rhbz#2225806)
- Fix brp-compress search path to correctly compress man pages in /app
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 37-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jan 25 2023 Kalev Lember <klember@redhat.com> - 37-5
- Redefine __perl macro as /usr/bin/perl
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 37-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Sep 06 2022 Kalev Lember <klember@redhat.com> - 37-3
- Fix host search paths for noarch builds
* Tue Aug 23 2022 Kalev Lember <klember@redhat.com> - 37-2
- Sync build_ldflags with redhat-rpm-config
- Drop python3_sitelib/sitearch overrides
- Override _fontbasedir to honor /app prefix
* Tue Aug 02 2022 Kalev Lember <klember@redhat.com> - 37-1
- Update %%python_sitearch for python-3.11 (#2113228)
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 35-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 35-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Oct 04 2021 Kalev Lember <klember@redhat.com> - 35-3
- Disable rpath checks as they don't work right for non-/usr prefix
* Fri Oct 01 2021 Kalev Lember <klember@redhat.com> - 35-2
- Sync ___build_pre section with macros from rpm 4.17.0
* Mon Aug 23 2021 Kalev Lember <klember@redhat.com> - 35-1
- Update %%python_sitearch for python-3.10 (#1987478)
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 34-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jun 29 2021 Kalev Lember <klember@redhat.com> - 34-1
- Override RPM's fontconfig auto-provide to handle /app/share/fonts
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 33-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Sep 19 2020 Kalev Lember <klember@redhat.com> - 33-2
- Redefine __python2 macro to point to /app/bin/python2
* Mon Sep 14 2020 Kalev Lember <klember@redhat.com> - 33-1
- Update %%python_sitearch for python-3.9
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 32-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 32-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Mar 18 2020 Kalev Lember <klember@redhat.com> - 32-2
- Remove Python 2 support (#1805232)
* Wed Mar 18 2020 Stephan Bergmann <sbergman@redhat.com> - 32-1
- Let xmvn_install store artifacts under /app
* Thu Feb 06 2020 David King <amigadave@amigadave.com> - 29-12
- Update %%python_sitearch for python-3.8 (#1799346)
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 29-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 29-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jun 20 2019 Kalev Lember <klember@redhat.com> - 29-9
- Use optflags, rather than __global_compiler_flags
* Thu Apr 04 2019 Stephan Bergmann <sbergman@redhat.com> - 29-8
- Add CFLAGS and CXXFLAGS to macros.flatpak, to match LDFLAGS
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 29-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Sep 27 2018 Owen Taylor <otaylor@redhat.com> - 29-6
- Fix accidentally not installing the macro file
* Thu Sep 27 2018 Owen Taylor <otaylor@redhat.com> - 29-5
- Install a distutils.cfg to redirect installation of Python packages to /app
this makes the package no longer noarch because the file is in
/usr/lib or /usr/lib64.
* Tue Sep 25 2018 Owen Taylor <otaylor@redhat.com> - 29-4
- Remove space in -L <libdir>
* Thu Sep 20 2018 Owen Taylor <otaylor@redhat.com> - 29-3
- Extend set of overriden Python macros
* Wed Sep 19 2018 Owen Taylor <otaylor@redhat.com> - 29-2
- Improve LDFLAGS flags handling in macros.flatpak
* Sat Sep 8 2018 Owen Taylor <otaylor@redhat.com> - 29-1
- Instead of defining %%app to true, define %%flatpak to 1
- Update %%python_sitearch for python-3.7
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 27-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 27-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 27-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 27-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue Jun 13 2017 Owen Taylor <otaylor@redhat.com> - 27-2
See https://bugzilla.redhat.com/show_bug.cgi?id=1460076
- Wrap description lines
- Own /etc/rpm, to avoid requiring rpm package
- Preserve timestamp on installation
* Wed May 31 2017 Owen Taylor <otaylor@redhat.com> - 27-1
- Initial version, based on work by Alex Larsson <alexl@redhat.com>

72
flatpak.xml Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="US-ASCII"?>
<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/2.0.0">
<repositories>
<!-- Repositories flatpak-jar and flatpak-jni are copies of base-jar and
base-jni from /usr/share/xmvn/configuration.xml (javapackages-tools),
with "usr" replaced by "app": -->
<repository>
<id>flatpak-jar</id>
<type>jpp</type>
<properties>
<root>app/share/java</root>
</properties>
<filter>
<or>
<and>
<equals>
<extension/>
<string>jar</string>
</equals>
<not>
<equals>
<property>native</property>
<string>true</string>
</equals>
</not>
</and>
<!-- Maybe /app/share/java is not the best place to store
ZIP files, but packages are doing so anyways and
allowing ZIPs here simplifies packaging. TODO: find a
better location for ZIP files. -->
<equals>
<extension/>
<string>zip</string>
</equals>
</or>
</filter>
</repository>
<repository>
<id>flatpak-jni</id>
<type>jpp</type>
<properties>
<root>app/lib/java</root>
</properties>
<filter>
<and>
<equals>
<extension/>
<string>jar</string>
</equals>
<equals>
<property>native</property>
<string>true</string>
</equals>
</and>
</filter>
</repository>
<!-- Repository install overrides the repository of the same name from
/usr/share/xmvn/configuration.xml (javapackages-tools), prepending the
above flatpak-jar and flatpak-jni: -->
<repository>
<id>install</id>
<type>compound</type>
<configuration>
<repositories>
<repository>flatpak-jar</repository>
<repository>flatpak-jni</repository>
<repository>base-install</repository>
</repositories>
</configuration>
</repository>
</repositories>
</configuration>

24
fontconfig-flatpak.prov Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/bash
#
# Script to install in:
# /usr/lib/rpm/redhat/find-provides.d
#
# Transform font files into RPM provides
# Requires fontconfig >= 2.6.90
#
# Author: Behdad Esfahbod <behdad@redhat.com>
# Based on other provides scripts from RPM
#
fcquery=/usr/bin/fc-query
if [ ! -x $fcquery ]; then
cat > /dev/null
exit 0
fi
# filter out anything outside main fontconfig paths
grep '/\(usr\|app\)/share/fonts/' |
while read fn; do
$fcquery --format '%{=pkgkit}' "${fn}" 2> /dev/null
done

88
macros.flatpak.in Normal file
View File

@ -0,0 +1,88 @@
%flatpak 1
%distcore .fc%{fedora}app
# This definition of dist in terms of distcore is standard in fedora-release from F40 on, but duplicated here for F39
%dist %{!?distprefix0:%{?distprefix}}%{expand:%{lua:for i=0,9999 do print("%{?distprefix" .. i .."}") end}}%{distcore}%{?with_bootstrap:%{__bootstrap}}
%_prefix /app
%_sysconfdir %{_prefix}/etc
%_localstatedir %{_prefix}/var
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} -L%{_prefix}/__LIB__
%__brp_compress %{_usr}/lib/rpm/brp-compress /app
%__git %{_bindir}/git
%__perl %{_usr}/bin/perl
%__python2 %{_bindir}/python2
%python2_sitelib %{_prefix}/lib/python2.7/site-packages
%python2_sitearch %{_libdir}/python2.7/site-packages
%_fontbasedir %{_datadir}/fonts
%___build_pre \
RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
RPM_OPT_FLAGS=\"%{optflags}\"\
RPM_LD_FLAGS=\"%{?build_ldflags}\"\
RPM_ARCH=\"%{_arch}\"\
RPM_OS=\"%{_os}\"\
RPM_BUILD_NCPUS=\"%{_smp_build_ncpus}\"\
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS RPM_LD_FLAGS\
RPM_DOC_DIR=\"%{_docdir}\"\
export RPM_DOC_DIR\
RPM_PACKAGE_NAME=\"%{NAME}\"\
RPM_PACKAGE_VERSION=\"%{VERSION}\"\
RPM_PACKAGE_RELEASE=\"%{RELEASE}\"\
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
LANG=C\
export LANG\
unset CDPATH DISPLAY ||:\
%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
export RPM_BUILD_ROOT}\
%{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
export CLASSPATH}\
CONFIG_SITE=${CONFIG_SITE:-NONE}\
export CONFIG_SITE\
ACLOCAL_PATH="%{_datadir}/aclocal:%{_usr}/share/aclocal"\
export ACLOCAL_PATH\
CPATH="%{_prefix}/include"\
export CPATH\
CPLUS_INCLUDE_PATH="%{_prefix}/include"\
export CPLUS_INCLUDE_PATH\
C_INCLUDE_PATH="%{_prefix}/include"\
export C_INCLUDE_PATH\
GI_TYPELIB_PATH="%{_prefix}/__LIB__/girepository-1.0:%{_usr}/__LIB__/girepository-1.0"\
export GI_TYPELIB_PATH\
INFOPATH="%{_datadir}/info"\
export INFOPATH\
MANPATH="%{_datadir}/man:"\
export MANPATH\
OBJC_INCLUDE_PATH="%{_prefix}/include"\
export OBJC_INCLUDE_PATH\
PATH="%{_bindir}:%{_usr}/local/sbin:%{_usr}/bin:/bin:%{_usr}/sbin:/sbin"\
PKG_CONFIG_GLADEUI_2_0_CATALOGDIR="%{_datadir}/glade/catalogs"\
export PKG_CONFIG_GLADEUI_2_0_CATALOGDIR\
PKG_CONFIG_PATH="%{_prefix}/__LIB__/pkgconfig:%{_datadir}/pkgconfig:%{_usr}/__LIB__/pkgconfig:%{_usr}/share/pkgconfig"\
export PKG_CONFIG_PATH\
XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:/etc/xdg"\
export XDG_CONFIG_DIRS\
XDG_DATA_DIRS="%{_datadir}:%{_usr}/local/share:%{_usr}/share"\
export XDG_DATA_DIRS\
GVFS_REMOTE_VOLUME_MONITOR_IGNORE="1"\
export GVFS_REMOTE_VOLUME_MONITOR_IGNORE\
JAVA_HOME="%{_prefix}/lib/jvm/jre"\
export JAVA_HOME\
pandoc_datadir="%{_datadir}/pandoc-3.1.3"\
export pandoc_datadir\
\
%[%{verbose}?"set -x":""]\
umask 022\
cd \"%{u2p:%{_builddir}}\"\
# Override /usr/lib/rpm/fontconfig.prov with a version that also handles fonts
# in /app/share/fonts
%__font_provides %{_rpmconfigdir}/fontconfig-flatpak.prov
# Fix /usr/lib/rpm/fileattrs/maven.attr search path
%__maven_path ^/usr/share/maven-metadata/.*
# Search /app/etc/java for java.conf and javapackages-config.json
%jpb_env JAVACONFDIRS=%{_sysconfdir}/java
# rpm-build's rpath script hardcodes /usr and doesn't work right for /app prefix
%__brp_check_rpaths %{nil}
# Override buildroot jurand macros which mistakenly use %%_bindir
%java_remove_imports /usr/bin/jurand -i
%java_remove_annotations /usr/bin/jurand -i -a

0
sources Normal file
View File