#1 Make builds for inclusion in an application Flatpak work
Opened 2 years ago by otaylor. Modified 2 years ago
rpms/ otaylor/perl flatpak  into  master

file modified
+23 -3

@@ -81,7 +81,7 @@ 

  Epoch:          %{perl_epoch}

  Version:        %{perl_version}

  # release number must be even higher, because dual-lived modules will be broken otherwise

- Release:        423%{?dist}

+ Release:        424%{?dist}

  Summary:        Practical Extraction and Report Language

  Url:            https://www.perl.org/

  Source0:        https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz

@@ -2906,10 +2906,8 @@ 

          -Dcc='%{__cc}' \

          -Dcf_by='Red Hat, Inc.' \

          -Dprefix=%{_prefix} \

- %if %{without perl_enables_groff}

          -Dman1dir="%{_mandir}/man1" \

          -Dman3dir="%{_mandir}/man3" \

- %endif

          -Dvendorprefix=%{_prefix} \

          -Dsiteprefix=%{_prefix}/local \

          -Dsitelib="%{_prefix}/local/share/perl5" \

@@ -2917,6 +2915,9 @@ 

          -Dprivlib="%{privlib}" \

          -Dvendorlib="%{perl_vendorlib}" \

          -Darchlib="%{archlib}" \

+ %if 0%{?flatpak}

+         -Dotherlibdirs="/usr/share/perl5/vendor_perl:/usr/%{_lib}/perl5/vendor_perl:/usr/share/perl5:/usr/%{_lib}/perl5" \

+ %endif

          -Dvendorarch="%{perl_vendorarch}" \

          -Darchname=%{perl_archname} \

  %ifarch %{multilib_64_archs}

@@ -3110,6 +3111,14 @@ 

  %endif

  %endif

  

+ %if 0%{?flatpak}

+ # This symlink won't be included in the Flatpak, since it is outside of /app,

+ # but it is needed in the prefix=/app buildroot, since we need to be able to

+ # install modules that Require: /usr/bin/perl.

+ mkdir -p %{buildroot}/usr/bin

+ ln -s /app/bin/perl %{buildroot}/usr/bin/perl

+ %endif

+ 

  %ldconfig_scriptlets libs

  

  %files

@@ -3123,6 +3132,9 @@ 

  %{archlib}/*

  %{privlib}/*

  

+ %if 0%{?flatpak}

+ /usr/bin/perl

+ %endif

  

  # libs

  %exclude %dir %{archlib}

@@ -5108,6 +5120,14 @@ 

  

  # Old changelog entries are preserved in CVS.

  %changelog

+ * Mon Oct  1 2018 Owen Taylor <otaylor@redhat.com> - 4:5.28.0-424

+ - Always specify the manual package directory explicitly, even if groff

+   is enabled. Since we use %{_mandir} elsewhere in the spec file, it wouldn't

+   work if some other location was detected.

+ - For flatpak builds, install a symlink /usr/bin that points to /app/bin/perl.

+   This helps with #! lines and autogenerated Requires: /usr/bin/perl.

+ - For flatpak builds, build the interpreter to look in /usr as well as in /app.

+ 

  * Mon Sep 24 2018 Petr Pisar <ppisar@redhat.com> - 4:5.28.0-423

  - Fix upack "u" of invalid data (RT#132655)

  

  • Always specify the manual package directory explicitly, even if groff
    is enabled. Since we use %{_mandir} elsewhere in the spec file, it wouldn't
    work if some other location was detected.

We also need to make unrebuilt Perl modules in /usr work - this is needed
for bootstrapping the set of Perl core modules, and to use unrebuilt Perl
modules as build-time only dependencies. So, based on %{_flatpak}:

  • Install a symlink /usr/bin that points to /app/bin/perl. This helps with
    #! lines and autogenerated Requires: /usr/bin/perl.
  • Build the interpreter to look in /usr as well as in /app.

It may be a little confusing: why do we need to handle mixed environements with some perl modules in /app and some in /usr? This is for build time in the buildroot of a Flatpak module (flatpak-common or an application module.)

BuildRequires might either be straight up Fedora packages, or they may be themselves rebuilds with prefix=/app. If a package BuildRequires: gcc, that can be a normal Fedora packages, but if it BuildRequires: libfontenc-devel, then that should be the libfontenc-devel from a rebuild libfontenc.

Perl is somewhere in the middle - generally when perl is being used to run automake, etc, it could be used just like gcc. But we also want to rebuild it so we can bundle it into an application RPM. Once we rebuild it, the rebuilt package will be used to satisfy BuildRequires:, so we need to make sure that we can have a mixed environment with some perl modules in /usr and some perl modules in /app.

rebased onto db1b3e8

2 years ago