#============================================================================= # Overview of build options: # # End of build options #----------------------------------------------------------------------------- ##trace %global debug_package %{nil} # parallism is not supported so force single job compilation %global _smp_mflags -j1 %global version 0.16.0 %global release 1 %global gitdate 20220130 %global commit 147bcc3d0f3dfe5362b0136110313c64a43e317d %global shortcommit %(c=%{commit}; echo ${c:0:7}) # set this to "0" if not building a dev/beta/rc release %global beta_or_rc 0 %global gts_USR gotosocial %global gts_GRP gotosocial #============================================================================= # general #----------------------------------------------------------------------------- Name: gotosocial Version: %{version} %if %{beta_or_rc} Release: 0.%{release}.%{gitdate}git%{shortcommit}%{?dist} %else Release: %{release}%{?dist} %endif Summary: Fast, fun, ActivityPub server, powered by Go License: AGPL-3.0-only URL: https://github.com/superseriousbusiness/gotosocial %if %{beta_or_rc} Source0: https://github.com/superseriousbusiness/gotosocial/archive/%{commit}/gotosocial-%{version}-git%{shortcommit}.tar.gz %else Source0: https://github.com/superseriousbusiness/gotosocial/archive/%{version}.tar.gz#/gotosocial-%{version}.tar.gz %endif # go-swagger is not packaged so include the binary from # https://github.com/go-swagger/go-swagger Source1: swagger_linux_amd64 Source2: gotosocial-sysusers.conf Source3: gotosocial-tmpfiles.conf Patch0: gotosocial-use-fhs-directories.patch BuildRequires: git-core >= 2.43.5 BuildRequires: golang >= 1.22 # see Source1 #BuildRequires: go-swagger BuildRequires: make BuildRequires: nodejs >= 18 BuildRequires: npm BuildRequires: yarnpkg BuildRequires: systemd %{?systemd_requires} %description GoToSocial is an ActivityPub social network server, written in Golang. With GoToSocial, you can keep in touch with your friends, post, read, and share images and articles. All without being tracked or advertised to! #%%package nginx #Summary: Nginx configuration for %%{name} #Group: Development/Tools #Requires: %%{name} #Requires: nginx #%%description nginx #Nginx configuration files for %%{name} #============================================================================= # prep #----------------------------------------------------------------------------- %prep %if %{beta_or_rc} %setup -q -n %{name} %patch0 -p1 %else %setup -q -n %{name}-%{version} %patch0 -p1 #popd %endif # set version in the build script sed -i -e"s|\${VERSION.*}|%{version}|" scripts/build.sh cp -av %{SOURCE1} swagger chmod 0755 swagger # set accounts-registration-open: false sed -i -e's|^accounts-registration-open: true|accounts-registration-open: false|' example/config.yaml # set port to 8008 which has no SELinux AVC issues sed -ie -e's|^port: 8080|port: 8008|' example/config.yaml #============================================================================= # build #----------------------------------------------------------------------------- %build ./swagger generate spec --scan-models --exclude-deps -o web/assets/swagger.yaml sed -i -e "s/REPLACE_ME/%{version}/" web/assets/swagger.yaml ./scripts/build.sh # generate web assets yarn --cwd ./web/source install --frozen-lockfile yarn --cwd ./web/source ts-patch install yarn --cwd ./web/source build #============================================================================= # install #----------------------------------------------------------------------------- %install # create directories install -d -m0755 %{buildroot}%{_sysconfdir}/%{name} install -d -m0755 %{buildroot}%{_rundir}/%{name} install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}/storage install -d -m0755 %{buildroot}%{_localstatedir}/log/%{name} install -d -m0755 %{buildroot}%{_sysusersdir} install -d -m0755 %{buildroot}%{_tmpfilesdir} install -d -m0755 %{buildroot}%{_unitdir} install -v -D -m0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf install -v -D -m0644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -v -D -m0644 example/%{name}.service -t %{buildroot}%{_unitdir} # gotosocial server binary install -v -D -m0755 %{name} -t %{buildroot}%{_bindir} # config install -v -D -m0640 example/config.yaml -t %{buildroot}%{_sysconfdir}/%{name} # web frontend install -v -d %{buildroot}%{_datadir}/%{name} cp -v -a web/assets/* %{buildroot}%{_datadir}/%{name} cp -v -a web/template %{buildroot}%{_sysconfdir}/%{name} #============================================================================= # files #----------------------------------------------------------------------------- %files %license LICENSE %doc README.md ROADMAP.md example/config.yaml %{_bindir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/config.yaml %config(noreplace) %{_sysconfdir}/%{name}/template/*.tmpl %{_datadir}/%{name} %{_sysusersdir} %{_tmpfilesdir} %{_unitdir} %{_rundir}/%{name} %{_localstatedir}/lib/%{name} %{_localstatedir}/log/%{name} #============================================================================= # pre #----------------------------------------------------------------------------- %pre getent group %{gts_GRP} > /dev/null || groupadd -r %{gts_GRP} getent passwd %{gts_USR} > /dev/null || \ useradd -m -g %{gts_GRP} -s /bin/bash \ -c "%{gts_USR} account" -d /home/%{gts_USR} \ %{gts_USR} #============================================================================= # post #----------------------------------------------------------------------------- %post /sbin/restorecon -F -R /etc/gotosocial \ /run/gotosocial \ /usr/bin/gotosocial \ /usr/lib/systemd/system/gotosocial* \ /usr/share/gotosocial \ /var/lib/gotosocial \ /var/log/gotosocial > /dev/null systemctl daemon-reload %systemd_post gotosocial.service #============================================================================= # preun #----------------------------------------------------------------------------- %preun %systemd_preun gotosocial.service #============================================================================= # postun #----------------------------------------------------------------------------- %postun %systemd_postun_with_restart gotosocial.service #============================================================================= # changelog #----------------------------------------------------------------------------- %changelog * Wed Jul 17 2024 Patrick Laimbock - 0.16.0-1 - update to version 0.16.0 - require golang >= 1.22 - require nodejs >= 18 - update swagger_linux_amd64 to v0.31.0 (2024-05-12) * Sun Aug 27 2023 Patrick Laimbock - 0.11.1-3 - set accounts-registration-open to false in config.yaml * Sat Aug 26 2023 Patrick Laimbock - 0.11.1-2 - force SELinux security contexts restore of all gotosocial files in %%post - in config.yaml set port to 8008 to prevent an SELinux AVC - clean up * Thu Aug 24 2023 Patrick Laimbock - 0.11.1-1 - initial version 0.11.1 for EL9