# Generated by go2rpm 1.16.0 %bcond check 1 # https://github.com/TecharoHQ/anubis %global goipath github.com/TecharoHQ/anubis Version: 1.15.2 %gometa -L -f %global common_description %{expand: Weighs the soul of incoming HTTP requests using proof-of-work to stop AI crawlers.} Name: anubis Release: %autorelease Summary: Weighs the soul of incoming HTTP requests using proof-of-work to stop AI crawlers # Generated by go-vendor-tools License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml BuildRequires: go-vendor-tools BuildRequires: systemd-rpm-macros # To build the assets BuildRequires: bash BuildRequires: brotli BuildRequires: make BuildRequires: nodejs-npm BuildRequires: golang-github-evanw-esbuild BuildRequires: gzip BuildRequires: zstd %description %{common_description} %prep %goprep -A %setup -q -T -D -a1 %{forgesetupargs} # Remove prebuild assets rm web/static/js/main.mjs %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build # https://github.com/TecharoHQ/anubis/blob/16145049223cfb68c7a98bfc2cf0ef56f7e28ff5/web/build.sh pushd web esbuild js/main.mjs --sourcemap --bundle --minify --outfile=static/js/main.mjs "--banner:js=${LICENSE}" gzip -f -k static/js/main.mjs zstd -f -k --ultra -22 static/js/main.mjs brotli -fZk static/js/main.mjs popd # Temporarly leave the prebuilt one in place because we don't have postcss # packaged yet # https://github.com/TecharoHQ/anubis/blob/16145049223cfb68c7a98bfc2cf0ef56f7e28ff5/xess/build.sh # pushd xess # postcss ./xess.css -o xess.min.css # popd %gobuild -o %{gobuilddir}/bin/%{name} %{goipath}/cmd/%{name} %install %go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ install -Dpm0644 -t %{buildroot}%{_unitdir}/ run/anubis@.service install -Dpm0644 -t %{buildroot}%{_sysconfdir}/%{name}/ run/default.env %post %systemd_post anubis@default.service %preun %systemd_preun anubis@default.service %postun %systemd_postun_with_restart anubis@default.service %check %go_vendor_license_check -c %{S:2} %if %{with check} export DONT_USE_NETWORK=1 # Skip tests that don't work in mock because they spawn an HTTP server rm lib/anubis_test.go %gocheck %endif %files -f %{go_vendor_license_filelist} %license vendor/modules.txt %doc docs README.md %{_bindir}/%{name} %{_unitdir}/anubis@.service %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/default.env %changelog %autochangelog