# GOLANG # https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/ # https://docs.fedoraproject.org/en-US/quick-docs/publish-rpm-on-copr # https://rpm-software-management.github.io/rpm/manual/macros.html # https://rpm-packaging-guide.github.io/ %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} %global __os_install_post %{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 %global __brp_mangle_shebangs %{nil} %global __brp_strip %{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # RHEL8 rpmbuild and /usr/lib/.build-id # https://access.redhat.com/discussions/5045161 %global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # FORGEJO # https://codeberg.org/forgejo/forgejo # https://download.copr.fedorainfracloud.org/results/mdwalters/forgejo/fedora-41-x86_64/08404023-forgejo/forgejo.spec # https://forgejo.org/docs/next/contributor/from-source/ %global _fj_name forgejo %global _fj_pkgnm forgejo %global _fj_unitnm forgejo %global _fj_comment Lightweight, git-compatible software SCM forge %global _fj_descrip %{expand: %{_fj_comment}.} # https://spdx.org/licenses/GPL-3.0-or-later.html %global _fj_license GPL-3.0-or-later %global _fj_usr git %global _fj_grp git %global _fj_install_dir /usr/local/forgejo %global _fj_unit_dir /etc/systemd/system # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ # https://codeberg.org/forgejo/forgejo %global _fj0_scm_host https://codeberg.org %global _fj0_scm_repo forgejo/forgejo %global _fj0_scm_branch forgejo %global _fj0_scm_url %{_fj0_scm_host}/%{_fj0_scm_repo} %global _fj0_commit %( git ls-remote %{_fj0_scm_url} | grep -v remote | grep "refs/heads/%{_fj0_scm_branch}$" | cut -f1 ) %global _fj0_shortcommit %( c=%{_fj0_commit}; echo ${c} | head -c 7 ) %global _fj0_scm_repo_esc %( echo %{_fj0_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _fj0_scm_repo_norm %( echo %{_fj0_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _fj0_scm_branch_norm %( echo %{_fj0_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) # CODEBERG/FORGEJO API: # https://codeberg.org/api/swagger#/repository/repoGetArchive %global _fj0_scm_host_api %{_fj0_scm_host}/api/v1/repos %global _fj0_scm_tarball %{_fj0_scm_host_api}/%{_fj0_scm_repo}/archive/%{_fj0_commit}.tar.gz %global _fj0_scm_extract_dir %( basename %{_fj0_scm_repo} | tr '[:upper:]' '[:lower:]' | sed 's|_|-|g') %global forgeurl0 %{_fj0_scm_url} %global commit0 %{_fj0_commit} %global shortcommit0 %{_fj0_shortcommit} %global forgesource0 %{_fj0_scm_tarball} %global extractdir0 %{_fj0_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_fj_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_fj0_scm_branch} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_fj_comment} License: %{_fj_license} URL: %{forgeurl0} Source0: %{forgesource0} BuildRequires: bash BuildRequires: golang BuildRequires: nodejs-npm BuildRequires: systemd BuildRequires: systemd-rpm-macros %{?systemd_requires} Provides: forgejo = %{_same_evr} Obsoletes: forgejo < %{_same_evr} Requires: git Requires: git-core %description %{_fj_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a %build echo '##### STARTING BUILD #####' cd %{_builddir}/%{extractdir0} export GOPATH=%{_builddir}/GOPATH export GOBUILDDIR=%{_builddir}/GOBUILDDIR mkdir -p %{buildroot}%{_bindir} mkdir -p ${GOPATH}/src mkdir -p ${GOPATH}/bin mkdir -p ${GOBUILDDIR}/bin export PATH=${GOPATH}/bin:$PATH export GOPROXY=https://proxy.golang.org,direct export GOSUMDB=sum.golang.org export CGO_ENABLED=1 # no git info in rpm scm; prevent using git to determine version ln -s /bin/true ${GOPATH}/bin/git # USE UPDATED GO TOOLCHAIN # https://go.dev/dl/ # https://go.dev/doc/devel/release _go_toolchain_ver=$( grep toolchain go.mod | awk '{print $2}' | sed 's|go||g' ) go env -w GOTOOLCHAIN=go${_go_toolchain_ver}+auto go mod tidy %install echo '##### STARTING INSTALL #####' mkdir -p ${RPM_BUILD_ROOT}/%{_fj_impl_lyr_dir} install -D -p -m 755 \ redhat-linux-build/libVkLayer_window_system_integration.so \ ${RPM_BUILD_ROOT}/%{_fj_impl_lyr_dir} install -D -p -m 644 \ redhat-linux-build/VkLayer_window_system_integration.json \ ${RPM_BUILD_ROOT}/%{_fj_impl_lyr_dir} %post %preun %postun %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %dir %{_fj_install_dir} %{_fj_install_dir}/* # %%attr(0644,root,root) %%{_fj_unit_dir}/%%{_fj_pkgnm}.service %changelog * Sun Mar 9 2025 pgnd _ - bump 1741572503