From 066e452e8337c155d0138ac17b7ed54cb58b2051 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 16 Jun 2025 08:52:48 -0400 Subject: [PATCH] Working to build RPM sources and binary --- Makefile | 17 +++++++++-------- Makefile.dist | 47 ++++++++++++++++++++++++++++++++++++++++------- mailleur.spec.in | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 mailleur.spec.in diff --git a/Makefile b/Makefile index 29a8986..15e5d93 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,9 @@ -#-------------------------------------------------------------------- +#==================================================================== +#test area Makefile +include Makefile.dbg +#distribution area Makefile +include Makefile.dist + #Makefile to build the package #-------------------------------------------------------------------- #default make @@ -14,19 +19,13 @@ debug \ $(MAKE) -s -C $$i $@ ; \ done -clean : +clean : cleanrpm @ for i in $(SUBDIR) ; \ do \ $(MAKE) -s -C $$i $@ ; \ done @ - rm -fr $(APPNAME)-* -#==================================================================== -#test area Makefile -include Makefile.dbg -#distribution area Makefile -include Makefile.dist - #==================================================================== FEEDPAR = \ $(TESTIP) \ @@ -186,4 +185,6 @@ APPNAME = mailleur #Managing testarea SBINDIR = usr/sbin CURDIR = $(shell pwd) +#-------------------------------------------------------------------- +.PHONY: clean cleanrpm #=================================================================== diff --git a/Makefile.dist b/Makefile.dist index 6adcbb8..b8ec50c 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -1,25 +1,58 @@ +#==================================================================== #Makefile with all necessary to build distribution RPM +APPN = mailleur +#==================================================================== +binary : rpm + @ rpmbuild \ + --define "_topdir $(RPMDIR)" \ + --rebuild \ + --target `uname -m` \ + $(RPMDIR)/SRPMS/$(APPN)-$(VERSION).$(RELEASE)-dvl.src.rpm +rpm : cleanrpm tarfile spec + @ echo "Making '$(APLV)' RPM source file" + @ mkdir -p $(RPMDIR)/SOURCES; + rpmbuild -bs \ + --quiet \ + --define "_topdir $(RPMDIR)" \ + --define "_source_filedigest_algorithm md5" \ + --define "_binary_filedigest_algorithm md5" \ + spec + @ echo "'$(APLV)' RPM source file ready" tarfile : clean + @ mkdir -p $(RPMDIR)/SOURCES; @ echo "Making '$(APLV)' tar file" - @ mkdir -p \ - $(APLV)/app \ - $(APLV)/lib \ + @ mkdir -p \ + $(APLV)/app \ + $(APLV)/lib \ $(APLV) @ date > $(APLV)/$(APLV).build_date @ cp -a Makefile* $(APLV)/ @ cp -a app/Makefile $(APLV)/app/Makefile @ cp -a lib/Makefile $(APLV)/lib/Makefile - @ tar zcf $(APLV).tar.gz $(APLV) + @ tar zcf $(RPMDIR)/SOURCES/$(APLV).tar.gz $(APLV) @ echo "'$(APLV)' tar file ready" +spec : $(APPN).spec.in + @ sed \ + -e 's/@@DIST@@/dvl/g' \ + -e 's/@@APPN@@/$(APPN)/g' \ + -e 's/@@VERSION@@/$(VERSION).$(RELEASE)/g' \ + -e 's/@@RELEASE@@//g' \ + < $< > $@ + +cleanrpm: + @ rm -fr $(RPMDIR)/* spec + #==================================================================== -VERSION = `grep VERSION lib/numver.h | cut -d'"' -f2` -RELEASE = `grep RELEASE lib/numver.h | cut -d'"' -f2` -APPN = mailleur +#rpm definitions +RPMDIR = $(CURDIR)/rpmbuild +#==================================================================== +VERSION = $(shell echo `grep VERSION lib/numver.h | cut -d '"' -f2`) +RELEASE = $(shell echo `grep RELEASE lib/numver.h | cut -d '"' -f2`) APPV = $(VERSION).$(RELEASE) APLV = $(APPN)-$(APPV) #==================================================================== diff --git a/mailleur.spec.in b/mailleur.spec.in new file mode 100644 index 0000000..76ee076 --- /dev/null +++ b/mailleur.spec.in @@ -0,0 +1,44 @@ +#----------------------------------------------------------------------------- +%{?!dist: %define dist @@DIST@@} +#----------------------------------------------------------------------------- +Name : @@APPN@@ +Version : @@VERSION@@ +Release : @@RELEASE@@%{?dist} +Summary : Application to filter and manage E-mail traffic +Group : System Environment/Libraries + +Vendor : SAFE Inc. +License : GPLv2 +URL : http://mailleur.safe.ca/ + +Source0 : %{name}-@@VERSION@@.tar.gz +#----------------------------------------------------------------------------- +%description +'%{name}' is an email firewall. Its purpose is to filter all email, +rejecting viruses and unwelcome messages at the SMTP protocol level +(and avoids bouncing to forged originators). +It also provide extended audit logs, allowing effective mean to +search about email exchange within time and transaction context. + +#----------------------------------------------------------------------------- +%files +%defattr(-,root,root,-) + +#============================================================================= +%prep +%setup -q + +#----------------------------------------------------------------------------- +#building application +%build + +#----------------------------------------------------------------------------- +%clean +%{__rm} -rf %{buildroot} + +#----------------------------------------------------------------------------- +#installing program +%install + +#============================================================================= +%changelog -- 2.47.3