From e596a36d0646086cb6e0959cec1d688f1447e39f Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 18:13:49 +0200 Subject: [PATCH 01/10] RPM: use default build root --- rpm/SPECS/darling-cli-devenv.spec | 4 +++- rpm/SPECS/darling-macho-deps.spec | 4 +++- rpm/SPECS/darling.spec | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rpm/SPECS/darling-cli-devenv.spec b/rpm/SPECS/darling-cli-devenv.spec index 723a03cde..05b547c69 100644 --- a/rpm/SPECS/darling-cli-devenv.spec +++ b/rpm/SPECS/darling-cli-devenv.spec @@ -21,7 +21,6 @@ URL: https://www.darlinghq.org/ # Use this line for Source0 if there are ever official versions. # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: bash @@ -45,6 +44,9 @@ cp -rla . %{?buildroot}/ %{_libexecdir}/darling %changelog +* Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 +- Use default build root + * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Initial version working for Fedora 37 - Split package off from `darling` package diff --git a/rpm/SPECS/darling-macho-deps.spec b/rpm/SPECS/darling-macho-deps.spec index ce5386036..9695e1e71 100644 --- a/rpm/SPECS/darling-macho-deps.spec +++ b/rpm/SPECS/darling-macho-deps.spec @@ -17,7 +17,6 @@ URL: https://www.darlinghq.org/ # Use this line for Source0 if there are ever official versions. # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: bash @@ -41,5 +40,8 @@ cp darling-deps.req %{?buildroot}/usr/lib/rpm/ /usr/lib/rpm/darling-deps.req %changelog +* Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 +- Use default build root + * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Initial version working for Fedora 37 diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index 23c24b29e..adb726274 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -25,7 +25,6 @@ URL: https://www.darlinghq.org/ # Use this line for Source0 if there are ever official versions. # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: cmake clang bison flex python2 glibc-devel(x86-64) glibc-devel(x86-32) BuildRequires: fuse-devel systemd-devel @@ -308,6 +307,9 @@ popd %files gui-stubs -f build/files.gui-stubs.txt %changelog +* Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 +- Use default build root + * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 - Split package into multiple packages (one for each component of Darling) From f00a873c59e2558dfafdd64c48f4a58fbbc4559a Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 18:35:44 +0200 Subject: [PATCH 02/10] RPM: honor tar compression according to file extension and also transform '.' --- rpm/SPECS/darling.spec | 3 ++- rpm/build.bsh | 4 ++-- rpm/tarup.bsh | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index adb726274..f7e3e386f 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -278,7 +278,7 @@ pushd build rm -rf tmp/cli-devenv DESTDIR=tmp/cli-devenv %{__cmake} -DCOMPONENT=cli_dev -P cmake_install.cmake rm -f %{_sourcedir}/darling-cli-devenv.tar.gz - tar --transform "s|^\./|darling-cli-devenv/|" -cf %{_sourcedir}/darling-cli-devenv.tar.gz -C tmp/cli-devenv . + tar --transform "s|^\.|darling-cli-devenv|S" -caf %{_sourcedir}/darling-cli-devenv.tar.gz -C tmp/cli-devenv . popd %files @@ -309,6 +309,7 @@ popd %changelog * Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 - Use default build root +- Honor tar compression according to file extension * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 diff --git a/rpm/build.bsh b/rpm/build.bsh index a0c5c3d8e..d0d296abb 100755 --- a/rpm/build.bsh +++ b/rpm/build.bsh @@ -8,13 +8,13 @@ if [ -e "/src/rpm/SOURCES/darling.tar.gz" ]; then ln -sf /src/rpm/SOURCES/darling.tar.gz $HOME/rpmbuild/SOURCES/ else # Preparing tarball - tar --transform "s|^\./|./darling/|" -cf $HOME/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD . + tar --transform "s|^\.|darling|S" -caf $HOME/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD . fi if [ -e "/src/rpm/SOURCES/darling-macho-deps.tar.gz" ]; then ln -sf /src/rpm/SOURCES/darling-macho-deps.tar.gz $HOME/rpmbuild/SOURCES/ else - tar --transform "s|^\./|darling-macho-deps/|" -cf $HOME/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm . + tar --transform "s|^\.|darling-macho-deps|S" -caf $HOME/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm . fi if (cd /src && git describe --tags HEAD); then diff --git a/rpm/tarup.bsh b/rpm/tarup.bsh index c4c268ba4..a54666b25 100755 --- a/rpm/tarup.bsh +++ b/rpm/tarup.bsh @@ -9,5 +9,5 @@ fi if [ -e "${CWD}/SOURCES/darling-macho-deps.tar.gz" ]; then rm "${CWD}/SOURCES/darling-macho-deps.tar.gz" fi -tar --transform "s|^\./|darling/|" -cf "${CWD}/SOURCES/darling.tar.gz" -C "${CWD}/.." --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD . -tar --transform "s|^\./|darling-macho-deps/|" -cf "${CWD}/SOURCES/darling-macho-deps.tar.gz" -C "${CWD}/../tools/rpm" . +tar --transform "s|^\.|darling|S" -caf "${CWD}/SOURCES/darling.tar.gz" -C "${CWD}/.." --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD . +tar --transform "s|^\.|darling-macho-deps|S" -caf "${CWD}/SOURCES/darling-macho-deps.tar.gz" -C "${CWD}/../tools/rpm" . From b9835e2959467f5dfb4f0ada4ec7fcabad6906d4 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 18:39:07 +0200 Subject: [PATCH 03/10] RPM: move license file to the core package --- rpm/SPECS/darling.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index f7e3e386f..bca34f07d 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -282,11 +282,13 @@ pushd build popd %files -%doc LICENSE %files extra %files core -f build/files.core.txt +%attr(-, root, root) +%license LICENSE + %files system -f build/files.system.txt %files cli -f build/files.cli.txt %files ffi -f build/files.ffi.txt @@ -310,6 +312,7 @@ popd * Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 - Use default build root - Honor tar compression according to file extension +- Move license file to the core package * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 From caf102712d97735b2d32a7ec476118f904f417e9 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 18:46:46 +0200 Subject: [PATCH 04/10] RPM: use appropriate RPM macros --- rpm/SPECS/darling-cli-devenv.spec | 9 +++++++-- rpm/SPECS/darling-macho-deps.spec | 11 ++++++++--- rpm/SPECS/darling.spec | 14 +++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/rpm/SPECS/darling-cli-devenv.spec b/rpm/SPECS/darling-cli-devenv.spec index 05b547c69..394a32037 100644 --- a/rpm/SPECS/darling-cli-devenv.spec +++ b/rpm/SPECS/darling-cli-devenv.spec @@ -37,8 +37,12 @@ A Darling environment for CLI-only programs for building and developing using th true %install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -cp -rla . %{?buildroot}/ +%if "%{?buildroot}" != "" && "%{?buildroot}" != "/" +%{__rm} -Rf "%{buildroot}" +%{__mkdir_p} "%{dirname:%{buildroot}}" +%endif + +%{__cp} -rla . %{?buildroot}/ %files %{_libexecdir}/darling @@ -46,6 +50,7 @@ cp -rla . %{?buildroot}/ %changelog * Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 - Use default build root +- Use appropriate RPM macros * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Initial version working for Fedora 37 diff --git a/rpm/SPECS/darling-macho-deps.spec b/rpm/SPECS/darling-macho-deps.spec index 9695e1e71..c5a7a5a4a 100644 --- a/rpm/SPECS/darling-macho-deps.spec +++ b/rpm/SPECS/darling-macho-deps.spec @@ -30,10 +30,14 @@ An RPM dependency generator for Mach-O files, used by Darling to generate ELF de true %install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +%if "%{?buildroot}" != "" && "%{?buildroot}" != "/" +%{__rm} -Rf "%{buildroot}" +%{__mkdir_p} "%{dirname:%{buildroot}}" +%endif + %{__mkdir_p} %{?buildroot}/usr/lib/rpm/fileattrs -cp darling.attr %{?buildroot}/usr/lib/rpm/fileattrs/ -cp darling-deps.req %{?buildroot}/usr/lib/rpm/ +%{__cp} -p darling.attr %{?buildroot}/usr/lib/rpm/fileattrs/ +%{__cp} -p darling-deps.req %{?buildroot}/usr/lib/rpm/ %files /usr/lib/rpm/fileattrs/darling.attr @@ -42,6 +46,7 @@ cp darling-deps.req %{?buildroot}/usr/lib/rpm/ %changelog * Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 - Use default build root +- Use appropriate RPM macros * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Initial version working for Fedora 37 diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index bca34f07d..4019d04e7 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -222,7 +222,10 @@ pushd build popd %install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +%if "%{?buildroot}" != "" && "%{?buildroot}" != "/" +%{__rm} -Rf "%{buildroot}" +%{__mkdir_p} "%{dirname:%{buildroot}}" +%endif DARLING_COMPONENTS=( core system @@ -267,17 +270,17 @@ PACKAGE_SUFFIXES=( ) pushd build for index in {0..18}; do - rm -rf tmp/${PACKAGE_SUFFIXES[index]} + %{__rm} -rf tmp/${PACKAGE_SUFFIXES[index]} DESTDIR=tmp/${PACKAGE_SUFFIXES[index]} %{__cmake} -DCOMPONENT=${DARLING_COMPONENTS[index]} -P cmake_install.cmake find tmp/${PACKAGE_SUFFIXES[index]} \( ! -type d -o -type d -empty \) -printf '"/%%P"\n' > files.${PACKAGE_SUFFIXES[index]}.txt - cp -rla tmp/${PACKAGE_SUFFIXES[index]}/. %{?buildroot}/ + %{__cp} -rla tmp/${PACKAGE_SUFFIXES[index]}/. %{?buildroot}/ done # pack up a "source" (actually binary) tarball for `darling-cli-devenv` # NOTE: this is probably not the best approach. fix this if something better comes up. - rm -rf tmp/cli-devenv + %{__rm} -rf tmp/cli-devenv DESTDIR=tmp/cli-devenv %{__cmake} -DCOMPONENT=cli_dev -P cmake_install.cmake - rm -f %{_sourcedir}/darling-cli-devenv.tar.gz + %{__rm} -f %{_sourcedir}/darling-cli-devenv.tar.gz tar --transform "s|^\.|darling-cli-devenv|S" -caf %{_sourcedir}/darling-cli-devenv.tar.gz -C tmp/cli-devenv . popd @@ -313,6 +316,7 @@ popd - Use default build root - Honor tar compression according to file extension - Move license file to the core package +- Use appropriate RPM macros * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 From ecba53ffaea6f5fd88838f2a5c3347532a1a3aad Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:03:18 +0200 Subject: [PATCH 05/10] RPM: really use last commit date --- rpm/build.bsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rpm/build.bsh b/rpm/build.bsh index d0d296abb..d558c36db 100755 --- a/rpm/build.bsh +++ b/rpm/build.bsh @@ -17,8 +17,7 @@ else tar --transform "s|^\.|darling-macho-deps|S" -caf $HOME/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm . fi -if (cd /src && git describe --tags HEAD); then - DARLING_COMMIT_DATE="$(cd /src; git describe --tags HEAD)" +if DARLING_COMMIT_DATE="$(git -C /src log -1 --pretty=format:%cs HEAD)"; then export DARLING_COMMIT_DATE="${DARLING_COMMIT_DATE//-/}" else # default to the current date From 4a3655497af2a8610759ec3366b3fc611cec2c0d Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:25:21 +0200 Subject: [PATCH 06/10] RPM: make regular copy instead of hard links This avoids issues when the BUILD and BUILDROOT directories are on different filesystems in addition to when the underlying filesystem is a fuse-overlayfs (rootless container). --- rpm/SPECS/darling-cli-devenv.spec | 3 ++- rpm/SPECS/darling.spec | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rpm/SPECS/darling-cli-devenv.spec b/rpm/SPECS/darling-cli-devenv.spec index 394a32037..c3a75bf65 100644 --- a/rpm/SPECS/darling-cli-devenv.spec +++ b/rpm/SPECS/darling-cli-devenv.spec @@ -42,7 +42,7 @@ true %{__mkdir_p} "%{dirname:%{buildroot}}" %endif -%{__cp} -rla . %{?buildroot}/ +%{__cp} -PRp . %{?buildroot}/ %files %{_libexecdir}/darling @@ -51,6 +51,7 @@ true * Wed Oct 25 2023 Benjamin Gaillard - 0.1.20231025-1 - Use default build root - Use appropriate RPM macros +- Make regular copy instead of hard links to avoid filesystem issues * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Initial version working for Fedora 37 diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index 4019d04e7..4e93121cb 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -273,7 +273,7 @@ pushd build %{__rm} -rf tmp/${PACKAGE_SUFFIXES[index]} DESTDIR=tmp/${PACKAGE_SUFFIXES[index]} %{__cmake} -DCOMPONENT=${DARLING_COMPONENTS[index]} -P cmake_install.cmake find tmp/${PACKAGE_SUFFIXES[index]} \( ! -type d -o -type d -empty \) -printf '"/%%P"\n' > files.${PACKAGE_SUFFIXES[index]}.txt - %{__cp} -rla tmp/${PACKAGE_SUFFIXES[index]}/. %{?buildroot}/ + %{__cp} -PRp tmp/${PACKAGE_SUFFIXES[index]}/. %{?buildroot}/ done # pack up a "source" (actually binary) tarball for `darling-cli-devenv` @@ -317,6 +317,7 @@ popd - Honor tar compression according to file extension - Move license file to the core package - Use appropriate RPM macros +- Make regular copy instead of hard links to avoid filesystem issues * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 From 55421d841d7acd6e8af87eb05da515742cd9b184 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:32:51 +0200 Subject: [PATCH 07/10] RPM: use standard POSIX shell and utilities instead of Bash --- rpm/Dockerfile | 6 +- rpm/SPECS/darling-cli-devenv.spec | 3 - rpm/SPECS/darling-macho-deps.spec | 3 - rpm/SPECS/darling.spec | 130 ++++++++++++++---------------- rpm/build.bsh | 32 -------- rpm/build.sh | 32 ++++++++ rpm/{tarup.bsh => tarup.sh} | 5 +- 7 files changed, 98 insertions(+), 113 deletions(-) delete mode 100755 rpm/build.bsh create mode 100755 rpm/build.sh rename rpm/{tarup.bsh => tarup.sh} (83%) diff --git a/rpm/Dockerfile b/rpm/Dockerfile index eb860eaf4..d788581f8 100644 --- a/rpm/Dockerfile +++ b/rpm/Dockerfile @@ -1,10 +1,10 @@ ARG OS=fedora:37 FROM ${OS} -SHELL ["bash", "-euxvc"] +SHELL ["/bin/sh", "-euxvc"] RUN dnf install -y rpm-build dnf-utils rpmdevtools git; \ - source /etc/os-release; \ + . /etc/os-release; \ dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${VERSION_ID}.noarch.rpm; \ dnf clean all @@ -18,4 +18,4 @@ RUN rm /darling.spec RUN mkdir -p /root/rpmbuild/SOURCES -CMD bash -xv /src/rpm/build.bsh +CMD /src/rpm/build.sh diff --git a/rpm/SPECS/darling-cli-devenv.spec b/rpm/SPECS/darling-cli-devenv.spec index c3a75bf65..4bcecb629 100644 --- a/rpm/SPECS/darling-cli-devenv.spec +++ b/rpm/SPECS/darling-cli-devenv.spec @@ -8,7 +8,6 @@ %if "%{commit_date}" == "" %define commit_date 0 %endif -%global _buildshell /bin/bash Name: darling-cli-devenv Version: 0.1.%{commit_date} @@ -22,8 +21,6 @@ URL: https://www.darlinghq.org/ # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRequires: bash - Requires: darling-cli darling-python2 darling-ruby darling-perl darling-cli-devenv-gui-common darling-cli-devenv-gui-stubs-common darling-iosurface Conflicts: darling-gui darling-gui-stubs diff --git a/rpm/SPECS/darling-macho-deps.spec b/rpm/SPECS/darling-macho-deps.spec index c5a7a5a4a..d10a90b15 100644 --- a/rpm/SPECS/darling-macho-deps.spec +++ b/rpm/SPECS/darling-macho-deps.spec @@ -4,7 +4,6 @@ %if "%{commit_date}" == "" %define commit_date 0 %endif -%global _buildshell /bin/bash Name: darling-macho-deps Version: 0.1.%{commit_date} @@ -18,8 +17,6 @@ URL: https://www.darlinghq.org/ # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRequires: bash - %description An RPM dependency generator for Mach-O files, used by Darling to generate ELF dependencies for the library it builds diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index 4e93121cb..1ab4bc1fe 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -6,7 +6,6 @@ %if "%{commit_date}" == "" %define commit_date 0 %endif -%global _buildshell /bin/bash # explicitly ignore all the bogus dependencies that the auto-scanner finds in `/usr/libexec/darling` # @@ -37,7 +36,7 @@ BuildRequires: libxml2-devel elfutils-libelf-devel BuildRequires: libbsd-devel BuildRequires: ffmpeg-devel pulseaudio-libs-devel openssl-devel giflib-devel BuildRequires: libXrandr-devel libXcursor-devel libxkbfile-devel dbus-devel mesa-libGLU-devel -BuildRequires: vulkan-headers llvm-devel libcap-devel bash vulkan-loader-devel +BuildRequires: vulkan-headers llvm-devel libcap-devel vulkan-loader-devel Requires: darling-cli darling-python2 darling-ruby darling-perl darling-gui darling-gui-stubs darling-pyobjc @@ -209,80 +208,70 @@ GUI stub components of Darling %build %{__mkdir_p} build -pushd build - # Release is broken https://github.com/darlinghq/darling/issues/331 - # -DCMAKE_BUILD_TYPE=Release \ - CFLAGS="" CXXFLAGS="" CPPFLAGS="" LDFLAGS="" \ - %{__cmake} -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DOpenGL_GL_PREFERENCE=GLVND \ - -DDEBIAN_PACKAGING=ON \ - -DJSC_UNIFIED_BUILD=ON \ - .. - %{make_build} -j `nproc` -popd +cd build +# Release is broken https://github.com/darlinghq/darling/issues/331 +# -DCMAKE_BUILD_TYPE=Release \ +unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +%{__cmake} -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DOpenGL_GL_PREFERENCE=GLVND \ + -DDEBIAN_PACKAGING=ON \ + -DJSC_UNIFIED_BUILD=ON \ + .. +%{make_build} %install %if "%{?buildroot}" != "" && "%{?buildroot}" != "/" %{__rm} -Rf "%{buildroot}" %{__mkdir_p} "%{dirname:%{buildroot}}" %endif -DARLING_COMPONENTS=( - core - system - cli - ffi - cli_gui_common - iokitd - cli_dev_gui_common - cli_extra - gui - python - cli_python_common - pyobjc - ruby - perl - jsc_webkit_common - jsc - iosurface - cli_dev_gui_stubs_common - gui_stubs -) -PACKAGE_SUFFIXES=( - core - system - cli - ffi - cli-gui-common - iokitd - cli-devenv-gui-common - cli-extra - gui - python2 - cli-python2-common - pyobjc - ruby - perl - jsc-webkit-common - jsc - iosurface - cli-devenv-gui-stubs-common - gui-stubs -) -pushd build - for index in {0..18}; do - %{__rm} -rf tmp/${PACKAGE_SUFFIXES[index]} - DESTDIR=tmp/${PACKAGE_SUFFIXES[index]} %{__cmake} -DCOMPONENT=${DARLING_COMPONENTS[index]} -P cmake_install.cmake - find tmp/${PACKAGE_SUFFIXES[index]} \( ! -type d -o -type d -empty \) -printf '"/%%P"\n' > files.${PACKAGE_SUFFIXES[index]}.txt - %{__cp} -PRp tmp/${PACKAGE_SUFFIXES[index]}/. %{?buildroot}/ - done - - # pack up a "source" (actually binary) tarball for `darling-cli-devenv` - # NOTE: this is probably not the best approach. fix this if something better comes up. - %{__rm} -rf tmp/cli-devenv - DESTDIR=tmp/cli-devenv %{__cmake} -DCOMPONENT=cli_dev -P cmake_install.cmake - %{__rm} -f %{_sourcedir}/darling-cli-devenv.tar.gz - tar --transform "s|^\.|darling-cli-devenv|S" -caf %{_sourcedir}/darling-cli-devenv.tar.gz -C tmp/cli-devenv . -popd + +cd build + +for component in \ + core \ + system \ + cli \ + ffi \ + cli_gui_common \ + iokitd \ + cli_dev_gui_common:cli-devenv-gui-common \ + cli_extra \ + gui \ + python:python2 \ + cli_python_common:cli-python2-common \ + pyobjc \ + ruby \ + perl \ + jsc_webkit_common \ + jsc \ + iosurface \ + cli_dev_gui_stubs_common:cli-devenv-gui-stubs-common \ + gui_stubs +do + case "${component}" in + *:*) package="${component#*:}" component="${component%:*}" ;; + *) package="$(printf %s "${component}" | tr _ -)" ;; + esac + export DESTDIR="tmp/${package}" + %{__rm} -Rf "${DESTDIR}" + %{__cmake} -D COMPONENT="${component}" -P cmake_install.cmake + ( + cd "${DESTDIR}" + echo "%attr(-, root, root)" + find * -type d -empty | LC_ALL=C sort | sed -e 's|^|%dir "/|' -e 's|$|"|' + find * ! -type d | LC_ALL=C sort | sed -e 's|^|"/|' -e 's|$|"|' + ) >"files.${package}.txt" + %{__cp} -PRp "${DESTDIR}/." %{?buildroot}/ + %{__rm} -Rf "${DESTDIR}" +done + +# pack up a "source" (actually binary) tarball for `darling-cli-devenv` +# NOTE: this is probably not the best approach. fix this if something better comes up. +export DESTDIR=tmp/cli-devenv +%{__rm} -Rf "${DESTDIR}" +%{__cmake} -D COMPONENT=cli_dev -P cmake_install.cmake +%{__tar} --transform "s|^\.|darling-cli-devenv|S" -caf %{_sourcedir}/darling-cli-devenv.tar.gz -C "${DESTDIR}" . +%{__rm} -Rf "${DESTDIR}" %files @@ -318,6 +307,7 @@ popd - Move license file to the core package - Use appropriate RPM macros - Make regular copy instead of hard links to avoid filesystem issues +- Use standard POSIX shell and utilities instead of Bash * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 diff --git a/rpm/build.bsh b/rpm/build.bsh deleted file mode 100755 index d558c36db..000000000 --- a/rpm/build.bsh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -mkdir -p $HOME/rpmbuild/SOURCES - -if [ -e "/src/rpm/SOURCES/darling.tar.gz" ]; then - ln -sf /src/rpm/SOURCES/darling.tar.gz $HOME/rpmbuild/SOURCES/ -else - # Preparing tarball - tar --transform "s|^\.|darling|S" -caf $HOME/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD . -fi - -if [ -e "/src/rpm/SOURCES/darling-macho-deps.tar.gz" ]; then - ln -sf /src/rpm/SOURCES/darling-macho-deps.tar.gz $HOME/rpmbuild/SOURCES/ -else - tar --transform "s|^\.|darling-macho-deps|S" -caf $HOME/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm . -fi - -if DARLING_COMMIT_DATE="$(git -C /src log -1 --pretty=format:%cs HEAD)"; then - export DARLING_COMMIT_DATE="${DARLING_COMMIT_DATE//-/}" -else - # default to the current date - export DARLING_COMMIT_DATE="$(printf '%(%Y%m%d)T\n' -1)" -fi - -rpmbuild -bb /src/rpm/SPECS/darling-macho-deps.spec -sudo rpm -U --force $HOME/rpmbuild/RPMS/x86_64/darling-macho-deps*.rpm - -#spectool -g -R /src/rpm/SPECS/darling.spec -rpmbuild -bb /src/rpm/SPECS/darling.spec -rpmbuild -bb /src/rpm/SPECS/darling-cli-devenv.spec diff --git a/rpm/build.sh b/rpm/build.sh new file mode 100755 index 000000000..690857f86 --- /dev/null +++ b/rpm/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -euxv + +mkdir -p ~/rpmbuild/SOURCES + +if [ -e /src/rpm/SOURCES/darling.tar.gz ]; then + ln -sf /src/rpm/SOURCES/darling.tar.gz ~/rpmbuild/SOURCES/ +else + # Preparing tarball + tar --transform "s|^\.|darling|S" -caf ~/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude .git --exclude SOURCES --exclude=SRPMS --exclude RPMS --exclude BUILD . +fi + +if [ -e /src/rpm/SOURCES/darling-macho-deps.tar.gz ]; then + ln -sf /src/rpm/SOURCES/darling-macho-deps.tar.gz ~/rpmbuild/SOURCES/ +else + tar --transform "s|^\.|darling-macho-deps|S" -caf ~/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm . +fi + +if DARLING_COMMIT_DATE="$(git -C /src log -1 --pretty=format:%cs HEAD)"; then + export DARLING_COMMIT_DATE="$(echo "${DARLING_COMMIT_DATE}" | tr -d -)" +else + # default to the current date + export DARLING_COMMIT_DATE="$(date +%Y%m%d)" +fi + +rpmbuild -bb /src/rpm/SPECS/darling-macho-deps.spec +sudo rpm -U --force ~/rpmbuild/RPMS/$(uname -m)/darling-macho-deps*.rpm + +#spectool -g -R /src/rpm/SPECS/darling.spec +rpmbuild -bb /src/rpm/SPECS/darling.spec +rpmbuild -bb /src/rpm/SPECS/darling-cli-devenv.spec diff --git a/rpm/tarup.bsh b/rpm/tarup.sh similarity index 83% rename from rpm/tarup.bsh rename to rpm/tarup.sh index a54666b25..61e6612aa 100755 --- a/rpm/tarup.bsh +++ b/rpm/tarup.sh @@ -1,8 +1,9 @@ -#!/usr/bin/env bash +#!/bin/sh set -euxv -CWD="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" +CWD="$(cd -- "$(dirname -- "$(command -v -- "${0}")")"; pwd -P)" +mkdir "${CWD}/SOURCES" if [ -e "${CWD}/SOURCES/darling.tar.gz" ]; then rm "${CWD}/SOURCES/darling.tar.gz" fi From d13af8dcc075112945a98d2a864384ca5e864c11 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:38:46 +0200 Subject: [PATCH 08/10] RPM: remove Python 2 dependency Python 2 is obsolete and unavailable in recent distributions. --- rpm/Dockerfile | 6 +++++- rpm/SPECS/darling.spec | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rpm/Dockerfile b/rpm/Dockerfile index d788581f8..b1394ec1c 100644 --- a/rpm/Dockerfile +++ b/rpm/Dockerfile @@ -11,7 +11,11 @@ RUN dnf install -y rpm-build dnf-utils rpmdevtools git; \ COPY SPECS/darling.spec /darling.spec # Bootstrap -RUN yum-builddep -y /darling.spec; \ +RUN . /etc/os-release; \ + if [ "${VERSION_ID}" -le 38 ]; then \ + dnf install python2; \ + fi; \ + yum-builddep -y /darling.spec; \ dnf clean all RUN rm /darling.spec diff --git a/rpm/SPECS/darling.spec b/rpm/SPECS/darling.spec index 1ab4bc1fe..326003ded 100644 --- a/rpm/SPECS/darling.spec +++ b/rpm/SPECS/darling.spec @@ -25,7 +25,7 @@ URL: https://www.darlinghq.org/ # Source0: https://github.com/darlinghq/darling/archive/%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}.tar.gz -BuildRequires: cmake clang bison flex python2 glibc-devel(x86-64) glibc-devel(x86-32) +BuildRequires: cmake clang bison flex glibc-devel(x86-64) glibc-devel(x86-32) BuildRequires: fuse-devel systemd-devel BuildRequires: cairo-devel freetype-devel(x86-64) fontconfig-devel(x86-64) BuildRequires: freetype-devel(x86-32) fontconfig-devel(x86-32) make @@ -308,6 +308,7 @@ export DESTDIR=tmp/cli-devenv - Use appropriate RPM macros - Make regular copy instead of hard links to avoid filesystem issues - Use standard POSIX shell and utilities instead of Bash +- Remove Python 2 build dependency * Tue May 02 2023 Ariel Abreu - 0.1.20230502-1 - Update to latest version and Fedora 37 From 35e2679302a6abe4a5af12eadf2119f0b3c61311 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:40:54 +0200 Subject: [PATCH 09/10] RPM: Dockerfile: add EL support in addition to Fedora --- rpm/Dockerfile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/rpm/Dockerfile b/rpm/Dockerfile index b1394ec1c..ee81c9987 100644 --- a/rpm/Dockerfile +++ b/rpm/Dockerfile @@ -3,19 +3,35 @@ FROM ${OS} SHELL ["/bin/sh", "-euxvc"] -RUN dnf install -y rpm-build dnf-utils rpmdevtools git; \ - . /etc/os-release; \ - dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${VERSION_ID}.noarch.rpm; \ +RUN . /etc/os-release; \ + if [ -e /etc/fedora-release ]; then \ + dist=fedora; \ + else \ + dist=el; \ + fi; \ + dnf install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs \ + dnf-plugins-core git-core rpm-build sudo \ + "https://mirrors.rpmfusion.org/free/${dist}/rpmfusion-free-release-${VERSION_ID%%.*}.noarch.rpm"; \ dnf clean all COPY SPECS/darling.spec /darling.spec # Bootstrap RUN . /etc/os-release; \ - if [ "${VERSION_ID}" -le 38 ]; then \ - dnf install python2; \ + dnf_options='-y --setopt=install_weak_deps=False --setopt=tsflags=nodocs'; \ + if [ -e /etc/fedora-release ]; then \ + if [ "${VERSION_ID}" -le 38 ]; then \ + dnf install ${dnf_options} python2; \ + fi; \ + else \ + if [ "${VERSION_ID%%.*}" -ge 9 ]; then \ + dnf_options="${dnf_options} --enablerepo=crb --enablerepo=devel"; \ + else \ + dnf install ${dnf_options} python2; \ + dnf_options="${dnf_options} --enablerepo=powertools --enablerepo=devel"; \ + fi; \ fi; \ - yum-builddep -y /darling.spec; \ + dnf builddep ${dnf_options} /darling.spec; \ dnf clean all RUN rm /darling.spec From ce0de21e3a789e5fb8061ba1bbc98416348117b6 Mon Sep 17 00:00:00 2001 From: Benjamin Gaillard Date: Wed, 25 Oct 2023 19:41:48 +0200 Subject: [PATCH 10/10] RPM: Dockerfile: /src and /root/rpmbuild are expected to be volumes --- rpm/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/Dockerfile b/rpm/Dockerfile index ee81c9987..592e6465a 100644 --- a/rpm/Dockerfile +++ b/rpm/Dockerfile @@ -36,6 +36,6 @@ RUN . /etc/os-release; \ RUN rm /darling.spec -RUN mkdir -p /root/rpmbuild/SOURCES +VOLUME /src /root/rpmbuild CMD /src/rpm/build.sh