|
| 1 | +# Exclude automatically generated requires on java interpreter which is not |
| 2 | +# owned by any package |
| 3 | +%global __requires_exclude ^%{_jvmdir}/java |
| 4 | + |
| 5 | +# Don't run OSGi dependency generators on private (bundled) JARs |
| 6 | +%global __requires_exclude_from \\.jar$ |
| 7 | +%global __provides_exclude_from \\.jar$ |
| 8 | + |
| 9 | +# Generated list of bundled packages |
| 10 | +%global _local_file_attrs local_generator |
| 11 | +%global __local_generator_provides cat %{_builddir}/%{buildsubdir}/bundled-provides.txt |
| 12 | +%global __local_generator_path ^%{metadataPath}/.*$ |
| 13 | + |
| 14 | +%global debug_package %{nil} |
| 15 | + |
| 16 | +%global javaHomePath %{_jvmdir}/java-21-openjdk |
| 17 | +%global mavenHomePath %{_datadir}/%{name} |
| 18 | +%global metadataPath %{mavenHomePath}/maven-metadata |
| 19 | +%global artifactsPath %{_prefix}/lib |
| 20 | +%global launchersPath %{_libexecdir}/%{name} |
| 21 | + |
| 22 | +Name: javapackages-bootstrap |
| 23 | +Version: [...] |
| 24 | +Release: %autorelease |
| 25 | +Summary: A means of bootstrapping Java Packages Tools |
| 26 | +# For detailed info see the file javapackages-bootstrap-PACKAGE-LICENSING |
| 27 | +License: [...] |
| 28 | +URL: https://github.com/fedora-java/javapackages-bootstrap |
| 29 | +ExclusiveArch: %{java_arches} |
| 30 | + |
| 31 | +Source: https://github.com/fedora-java/javapackages-bootstrap/releases/download/%{version}/javapackages-bootstrap-%{version}.tar.zst# |
| 32 | + |
| 33 | +# License breakdown |
| 34 | +Source: javapackages-bootstrap-PACKAGE-LICENSING |
| 35 | + |
| 36 | +# To obtain the following sources: |
| 37 | +# tar -xf ${name}-${version}.tar.zst |
| 38 | +# pushd ${name}-${version} |
| 39 | +# ./downstream.sh clone |
| 40 | +# ./downstream.sh prep |
| 41 | +# ./downstream.sh archive |
| 42 | +# The results are in the archive directory |
| 43 | +Source: [...].tar.zst |
| 44 | + |
| 45 | +BuildRequires: byaccj |
| 46 | +BuildRequires: gcc |
| 47 | +BuildRequires: java-21-openjdk-devel |
| 48 | +BuildRequires: jurand |
| 49 | +BuildRequires: rpm-devel |
| 50 | + |
| 51 | +Requires: bash |
| 52 | +Requires: coreutils |
| 53 | +Requires: java-21-openjdk-devel |
| 54 | +Requires: procps-ng |
| 55 | +Requires: lujavrite%{?_isa} |
| 56 | + |
| 57 | +Requires: javapackages-common |
| 58 | + |
| 59 | +%description |
| 60 | +In a nutshell, Java Packages Bootstrap (JPB) is a standalone build of all Java |
| 61 | +software packages that are required for Java Packages Tools (JPT) to work. |
| 62 | + |
| 63 | +In order to achieve reliable and reproducible builds of Java packages while |
| 64 | +meeting Fedora policy that requires everything to be built from source, without |
| 65 | +using prebuilt binary artifacts, it is necessary to build the packages in a |
| 66 | +well-defined, acyclic order. Dependency cycles between packages are the biggest |
| 67 | +obstacle to achieving this goal and JPT is the biggest offender -- it requires |
| 68 | +more than a hundred of Java packages, all of which in turn build-require JPT. |
| 69 | + |
| 70 | +JPB comes with a solution to this problem -- it builds everything that JPT needs |
| 71 | +to work, without reliance on any Java software other than OpenJDK. JPT can |
| 72 | +depend on JPB for everything, without depending on any other Java packages. For |
| 73 | +example, JPB contains embedded version of XMvn, removing dependency of JPT on |
| 74 | +XMvn, allowing JPT to be used before one builds XMvn package. |
| 75 | + |
| 76 | +%prep |
| 77 | +%autosetup -p1 -C |
| 78 | +mkdir archive/ |
| 79 | +cp %{sources} archive/ |
| 80 | +./downstream.sh prep-from-archive |
| 81 | + |
| 82 | +%build |
| 83 | +JAVA_HOME=%{javaHomePath} ./mbi.sh build -parallel |
| 84 | + |
| 85 | +%install |
| 86 | +JAVA_HOME=%{javaHomePath} ./mbi.sh dist \ |
| 87 | + -javaCmdPath=%{javaHomePath}/bin/java \ |
| 88 | + -basePackageName=%{name} \ |
| 89 | + -installRoot=%{buildroot} \ |
| 90 | + -mavenHomePath=%{mavenHomePath} \ |
| 91 | + -metadataPath=%{metadataPath} \ |
| 92 | + -artifactsPath=%{artifactsPath} \ |
| 93 | + -launchersPath=%{launchersPath} \ |
| 94 | + -licensesPath=%{_licensedir}/%{name} \ |
| 95 | + |
| 96 | +install -D -p -m 644 downstream/xmvn-generator/src/main/lua/xmvn-generator.lua %{buildroot}%{_rpmluadir}/%{name}-generator.lua |
| 97 | +install -D -p -m 644 downstream/xmvn-generator/src/main/rpm/macros.xmvngen %{buildroot}%{_rpmmacrodir}/macros.jpbgen |
| 98 | +install -D -p -m 644 downstream/xmvn-generator/src/main/rpm/macros.xmvngenhook %{buildroot}%{_sysconfdir}/rpm/macros.jpbgenhook |
| 99 | +install -D -p -m 644 downstream/xmvn-generator/src/main/rpm/xmvngen.attr %{buildroot}%{_fileattrsdir}/jpbgen.attr |
| 100 | + |
| 101 | +echo ' |
| 102 | +%%__xmvngen_debug 1 |
| 103 | +%%__xmvngen_libjvm %{javaHomePath}/lib/server/libjvm.so |
| 104 | +%%__xmvngen_classpath %{artifactsPath}/%{name}/xmvn-generator.jar:%{artifactsPath}/%{name}/asm.jar:%{artifactsPath}/%{name}/commons-compress.jar |
| 105 | +%%__xmvngen_provides_generators org.fedoraproject.xmvn.generator.jpms.JPMSGeneratorFactory |
| 106 | +%%__xmvngen_requires_generators %%{nil} |
| 107 | +%%__xmvngen_post_install_hooks org.fedoraproject.xmvn.generator.transformer.TransformerHookFactory |
| 108 | +%%jpb_env PATH=/usr/libexec/javapackages-bootstrap:$PATH |
| 109 | +' >%{buildroot}%{_rpmmacrodir}/macros.jpbgen |
| 110 | + |
| 111 | +sed -i s/xmvn-generator/%{name}-generator/ %{buildroot}%{_sysconfdir}/rpm/macros.jpbgenhook |
| 112 | +sed -i s/xmvn-generator/%{name}-generator/ %{buildroot}%{_fileattrsdir}/jpbgen.attr |
| 113 | +sed -i s/_xmvngen_/_jpbgen_/ %{buildroot}%{_fileattrsdir}/jpbgen.attr |
| 114 | + |
| 115 | +# Dynamically generate bundled Provides |
| 116 | +./downstream.sh bundled-provides >bundled-provides.txt |
| 117 | + |
| 118 | +%check |
| 119 | +%{buildroot}%{launchersPath}/xmvn --version |
| 120 | + |
| 121 | +%files |
| 122 | +%{mavenHomePath} |
| 123 | +%{metadataPath}/* |
| 124 | +%{artifactsPath}/* |
| 125 | +%{launchersPath}/* |
| 126 | +%{_rpmluadir}/* |
| 127 | +%{_rpmmacrodir}/* |
| 128 | +%{_fileattrsdir}/* |
| 129 | +%{_sysconfdir}/rpm/* |
| 130 | + |
| 131 | +%license %{_licensedir}/%{name} |
| 132 | +%doc README.md |
| 133 | +%doc AUTHORS |
| 134 | + |
| 135 | +%changelog |
| 136 | +%autochangelog |
0 commit comments