diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3fc9852 --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ +# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers. +# Copyright (C) 2019, 2020 GenZmeY +# mailto: genzmey@gmail.com +# +# This file is part of kf2-srv. +# +# kf2-srv is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +NAME := "kf2-srv" + +RPMBUILDDIR := "$$HOME/rpmbuild" +ACTIVEDIR := $(shell readlink -e "$$HOME/rpmbuild") +WORKDIR := $(shell readlink -e ".") + +BUILDDIR := $(WORKDIR)/BUILD +BUILDROOTDIR := $(WORKDIR)/BUILDROOT +RPMSDIR := $(WORKDIR)/RPMS +SOURCESDIR := $(WORKDIR)/SOURCES +SPECSDIR := $(WORKDIR)/SPECS +SRPMSDIR := $(WORKDIR)/SRPMS +SCRIPTSDIR := $(SOURCESDIR)/scripts + +SPEC := $(SPECSDIR)/$(NAME).spec +SOURCETARBALL := $(SOURCESDIR)$(NAME)-$(VERSION).tar.gz + +VERSION := $(shell grep -Fi 'Version:' $(SPEC) | awk '{ print $$2 }') + +.PHONY: all prep rpm srpm activate check-activate clean-tmp clean-pkg clean + +all: check-activate prep + rpmbuild -ba $(SPEC) + $(MAKE) clean-tmp + +prep: clean-tmp + tar czf $(SOURCETARBALL) -C $(SCRIPTSDIR) . + +rpm: check-activate prep + rpmbuild -bb $(SPEC) + $(MAKE) clean-tmp + +srpm: check-activate prep + rpmbuild -bs $(SPEC) + $(MAKE) clean-tmp + +activate: + ifeq ($(shell test -d $(RPMBUILDDIR); echo $$?), 0) + mv -f $(RPMBUILDDIR) $(RPMBUILDDIR).old + else + rm -f $(RPMBUILDDIR) + endif + ln -s $(WORKDIR) $(RPMBUILDDIR) + +check-activate: + ifneq ($(ACTIVEDIR), $(WORKDIR)) + $(error project is not active) + endif + +clean-tmp: + rm -rf $(BUILDDIR) + rm -rf $(BUILDROOTDIR) + rm -rf $(SOURCETARBALL) + +clean-pkg: + rm -rf $(RPMSDIR) + rm -rf $(SRPMSDIR) + +clean: clean-tmp clean-pkg + diff --git a/SOURCES/COPYING b/SOURCES/scripts/COPYING similarity index 100% rename from SOURCES/COPYING rename to SOURCES/scripts/COPYING diff --git a/SOURCES/kf2-srv b/SOURCES/scripts/kf2-srv similarity index 100% rename from SOURCES/kf2-srv rename to SOURCES/scripts/kf2-srv diff --git a/SOURCES/kf2-srv-beta b/SOURCES/scripts/kf2-srv-beta similarity index 100% rename from SOURCES/kf2-srv-beta rename to SOURCES/scripts/kf2-srv-beta diff --git a/SOURCES/kf2-srv-force-attr b/SOURCES/scripts/kf2-srv-force-attr similarity index 100% rename from SOURCES/kf2-srv-force-attr rename to SOURCES/scripts/kf2-srv-force-attr diff --git a/SPECS/kf2-srv.spec b/SPECS/kf2-srv.spec index 3136054..98e568c 100644 --- a/SPECS/kf2-srv.spec +++ b/SPECS/kf2-srv.spec @@ -8,6 +8,7 @@ Group: Amusements/Games License: GNU GPLv3 BuildArch: noarch +Source0: %{name}-%{version}.tar.gz Source1: %{name} Source2: %{name}-beta Source3: %{name}.xml diff --git a/activate.sh b/activate.sh deleted file mode 100755 index 37d1f69..0000000 --- a/activate.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -ScriptFullname=$(readlink -e "$0") -SrpmProjectDir=$(dirname "$ScriptFullname") -RpmBuild="$HOME/rpmbuild" - -if [[ -d "$RpmBuild" ]]; then - rm -rf "$RpmBuild" -else - rm -f "$RpmBuild" -fi - -ln -s "$SrpmProjectDir" "$RpmBuild"