From: Jean-Marc Pigeon (Delson) Date: Sat, 12 Jul 2025 18:04:05 +0000 (-0400) Subject: Standard way to compile exec integrated to mailleur rpm spec file X-Git-Tag: tag-0.14~117 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=9603b34944b59d893678574c7de3ec798590a207;p=jmp%2Fmailleur Standard way to compile exec integrated to mailleur rpm spec file --- diff --git a/Makefile b/Makefile index 7b4778f..f65a992 100644 --- a/Makefile +++ b/Makefile @@ -206,12 +206,12 @@ install : @ install -d $(DESTDIR)/$(ETCDIR)/pki/$(APPN)/ @ install -d $(DESTDIR)/$(ETCDIR)/sysconfig/ @ install -d $(DESTDIR)/$(LIBDIR)/$(APPN)/ - @ install -d $(DESTDIR)/$(SBINDIR)/ + @ install -d $(DESTDIR)/$(EXECDIR)/$(APPN)/ @ install -d $(DESTDIR)/$(SPOOLDIR)/$(APPN)/mails @ install -d $(DESTDIR)/$(SPOOLDIR)/$(APPN)/queue @ cp -a \ - bin/* \ - $(DESTDIR)/$(SBINDIR)/ + bin-*/ \ + $(DESTDIR)/$(EXECDIR)/$(APPN) @ cp -a \ conf/$(APPN).conf \ $(DESTDIR)/$(ETCDIR)/$(APPN) @@ -256,6 +256,7 @@ LIBDIR = /usr/lib DATADIR = /usr/share SBINDIR = /usr/sbin SPOOLDIR= /var/spool +EXECDIR = /usr/libexec ETCDIR = /etc CURDIR = $(shell pwd) #-------------------------------------------------------------------- diff --git a/app/Makefile b/app/Makefile index 9652a90..19fbe4c 100644 --- a/app/Makefile +++ b/app/Makefile @@ -15,33 +15,23 @@ exe : clean : - rm -fr *.o $(EXE) - - rm -fr ../bin-*/* + - rm -fr ../bin-* + - mkdir -p ../bin-posql ../bin-mysql #-------------------------------------------------------------------- #Equivalences #-------------------------------------------------------------------- EXE = \ - posql \ - mysql \ - -BINARIES= \ chkspf \ feeder \ - -POSSPEC = \ - rcvrpsql \ - sndrpsql \ - srtrpsql \ - -MYSSPEC = \ - rcvrmsql \ - sndrmsql \ - srtrmsql \ + receiver \ + sender \ + sorter \ SRC = \ chkspf.c \ receiver.c \ - freeder.c \ + feeder.c \ scanner.c \ sender.c \ sorter.c \ @@ -63,69 +53,50 @@ LIBS = $(LIBMAIL) \ #-------------------------------------------------------------------- #Dependances #-------------------------------------------------------------------- -posql : toremake - @ rm -fr ../bin-$@/* - @ $(MAKE) $(BINARIES) $(POSSPEC) - @ mv ../bin-common/* ../bin-$@/ - -mysql : toremake - @ rm -fr ../bin-$@/* - @ $(MAKE) $(BINARIES) $(MYSSPEC) - @ mv ../bin-common/* ../bin-$@/ - chkspf : toremake chkspf.o - @ $(LD) $(LDFLAGS) -o ../bin-common/$@ $@.o $(LIBS) + @ $(LD) $(LDFLAGS) -o ../bin-posql/$@ $@.o $(LIBS) + @ $(LD) $(LDFLAGS) -o ../bin-mysql/$@ $@.o $(LIBS) feeder : toremake feeder.o - @ $(LD) $(LDFLAGS) -o ../bin-common/$@ $@.o $(LIBS) + @ $(LD) $(LDFLAGS) -o ../bin-posql/$@ $@.o $(LIBS) + @ $(LD) $(LDFLAGS) -o ../bin-mysql/$@ $@.o $(LIBS) -rcvrpsql: toremake receiver.o +receiver: toremake receiver.o @ $(LD) $(LDFLAGS) \ -o ../bin-posql/receiver receiver.o \ $(LIBS) \ ../lib/libpos.a \ -lpq - -rcvrmsql: toremake receiver.o @ $(LD) $(LDFLAGS) \ -o ../bin-mysql/receiver receiver.o \ $(LIBS) \ ../lib/libmar.a \ -lmysqlclient -sndrpsql: toremake sender.o +sender: toremake sender.o @ $(LD) $(LDFLAGS) \ -o ../bin-posql/sender sender.o \ $(LIBS) \ ../lib/libpos.a \ -lpq - -sndrmsql: toremake sender.o @ $(LD) $(LDFLAGS) \ -o ../bin-mysql/sender sender.o \ $(LIBS) \ ../lib/libmar.a \ -lmysqlclient -srtrpsql: toremake sorter.o +sorter: toremake sorter.o @ $(LD) $(LDFLAGS) \ -o ../bin-posql/sorter sorter.o \ $(LIBS) \ ../lib/libpos.a \ -lpq - -srtrmsql: toremake sorter.o @ $(LD) $(LDFLAGS) \ -o ../bin-mysql/sorter sorter.o \ $(LIBS) \ ../lib/libmar.a \ -lmysqlclient - - -sender : toremake sender.o - @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) - chkspf.o: chkspf.c \ ../lib/unidns.h \ ../lib/subafn.h \ diff --git a/app/Makefile-postgres b/app/Makefile-postgres new file mode 100644 index 0000000..95e6765 --- /dev/null +++ b/app/Makefile-postgres @@ -0,0 +1,141 @@ +#-------------------------------------------------------------------- +#Executable generation area +#-------------------------------------------------------------------- +debug : + @ $(MAKE) OPTIME="-g" DEBUG="-DDEBUG" exe + @ echo "application compiled in '$@' mode now ready" + +prod : + @ $(MAKE) OPTIME="-g -O2" exe + @ echo "application compiled in '$@' mode now ready" + +exe : + $(MAKE) $(EXE) + + +clean : + - rm -fr *.o $(EXE) + - rm -fr ../bin-*/* + +#-------------------------------------------------------------------- +#Equivalences +#-------------------------------------------------------------------- +EXE = \ + bigre \ + receiver \ + sender \ + sorter \ + + +SRC = \ + receiver.c \ + sender.c \ + sorter.c \ + +#-------------------------------------------------------------------- +#definitions +#-------------------------------------------------------------------- +CC = gcc +LD = gcc -g +CFLAGS = -I ../lib -Wall $(OPTIME) +LIBMAIL = ../lib/libmail.a + +LIBS = $(LIBMAIL) \ + -luuid \ + -lcrypto \ + -lcrypt \ + -lssl \ + +#-------------------------------------------------------------------- +#Dependances +#-------------------------------------------------------------------- +receiver: toremake $@.o + @ $(LD) $(LDFLAGS) \ + -o ../bin-posql/$@ $@.o \ + $(LIBS) \ + ../lib/libpos.a \ + -lpq + +sndrpsql: toremake sender.o + @ $(LD) $(LDFLAGS) \ + -o ../bin-posql/sender sender.o \ + $(LIBS) \ + ../lib/libpos.a \ + -lpq + +sndrmsql: toremake sender.o + @ $(LD) $(LDFLAGS) \ + -o ../bin-mysql/sender sender.o \ + $(LIBS) \ + ../lib/libmar.a \ + -lmysqlclient + +srtrpsql: toremake sorter.o + @ $(LD) $(LDFLAGS) \ + -o ../bin-posql/sorter sorter.o \ + $(LIBS) \ + ../lib/libpos.a \ + -lpq + +srtrmsql: toremake sorter.o + @ $(LD) $(LDFLAGS) \ + -o ../bin-mysql/sorter sorter.o \ + $(LIBS) \ + ../lib/libmar.a \ + -lmysqlclient + + + +sender : toremake sender.o + @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) + +chkspf.o: chkspf.c \ + ../lib/unidns.h \ + ../lib/subafn.h \ + ../lib/subrou.h + +receiver.o:receiver.c \ + ../lib/modrec.h \ + ../lib/unitls.h \ + ../lib/unisig.h \ + ../lib/uniprc.h \ + ../lib/unipar.h \ + ../lib/unidns.h \ + ../lib/subrou.h + +feeder.o: feeder.c \ + ../lib/gestcp.h \ + ../lib/devsoc.h \ + ../lib/unieml.h \ + ../lib/unipar.h \ + ../lib/subrou.h + +sorter.o: sorter.c \ + ../lib/geseml.h \ + ../lib/unisig.h \ + ../lib/uniprc.h \ + ../lib/unipar.h \ + ../lib/unieml.h \ + ../lib/unidns.h \ + ../lib/subrou.h + +sender.o: sender.c \ + ../lib/lvleml.h \ + ../lib/geseml.h \ + ../lib/unieml.h \ + ../lib/unipar.h \ + ../lib/uniprc.h \ + ../lib/unisig.h \ + ../lib/subrou.h + +toremake: Makefile + touch toremake + @ - mkdir -p ../bin-common + @ - mkdir -p ../bin-posql + @ - mkdir -p ../bin-mysql + - echo Bingo + - rm -f $(EXE) *.o + +#-------------------------------------------------------------------- +.PHONY: toremake +#-------------------------------------------------------------------- diff --git a/mailleur.spec.in b/mailleur.spec.in index 30e1e36..5e06547 100644 --- a/mailleur.spec.in +++ b/mailleur.spec.in @@ -43,8 +43,6 @@ search about email exchange within time and transaction context. %attr(0644,root,root) %config(noreplace) %{dovedir}/dovecot.conf %{dovedir}/dovecot-2.0* %attr(0640,%{name},dovecot) %config(noreplace) %{dovedir}/passfile -%{_sbindir}/chkspf -%{_sbindir}/feeder %attr(0754,root,root) %{_libdir}/%{name}/shell/*.sh %attr(0754,root,root) %{_libdir}/%{name}/support/addconfig.sh %attr(0754,root,root) %{_libdir}/%{name}/support/crdb.sh @@ -152,9 +150,7 @@ Obsoletes : %{name}-mysql <= %{version}-%{release} #----------------------------------------------------------------------------- %files postgresql %defattr(-,root,root,-) -%attr(0755,%{name},mail) %{_sbindir}/rcvrpsql -%attr(0755,%{name},mail) %{_sbindir}/sndrpsql -%attr(0755,%{name},mail) %{_sbindir}/srtrpsql +%attr(0755,%{name},mail) %{_libexecdir}/%{name}/bin-posql/* %post postgresql OS=`%{_libdir}/%{name}/shell/getsysos.sh` @@ -166,15 +162,18 @@ if [ "$1" = 1 ]; then fi #generating postgresql receiver and sender -%{__ln_s} -nf \ - ./rcvrpsql \ - %{_sbindir}/receiver -%{__ln_s} -nf \ - ./sndrpsql \ - %{_sbindir}/sender -%{__ln_s} -nf \ - ./srtrpsql \ - %{_sbindir}/sorter +#generating exec to be path of the /usr/sbin path +for exe in \ + chkspf \ + feeder \ + receiver \ + sender \ + sorter + do + %{__ln_s} -nsf \ + %{_libexecdir}/%{name}/bin-posql/$exe \ + %{_sbindir} + done case "$OS" in "sysv" | \ @@ -193,6 +192,8 @@ case "$OS" in %postun postgresql if [ "$1" = 0 ]; then + rm -f %{_sbindir}/chkspf + rm -f %{_sbindir}/feeder rm -f %{_sbindir}/receiver rm -f %{_sbindir}/sender rm -f %{_sbindir}/sorter @@ -216,9 +217,7 @@ Obsoletes : %{name}-postgresql <= %{version}-%{release} #----------------------------------------------------------------------------- %files mysql %defattr(-,root,root,-) -%attr(0755,%{name},mail) %{_sbindir}/rcvrmsql -%attr(0755,%{name},mail) %{_sbindir}/sndrmsql -%attr(0755,%{name},mail) %{_sbindir}/srtrmsql +%attr(0755,%{name},mail) %{_libexecdir}/%{name}/bin-mysql/* %post mysql OS=`%{_libdir}/%{name}/shell/getsysos.sh` @@ -228,16 +227,18 @@ if [ "$1" = 1 ]; then -e "s/^DB_PORT=.*$/DB_PORT=3306/" \ %{_sysconfdir}/%{name}/%{name}.conf fi -#generating mysql receiver and sender -%{__ln_s} -nf \ - ./rcvrmsql \ - %{_sbindir}/receiver -%{__ln_s} -nf \ - ./sndrmsql \ - %{_sbindir}/sender -%{__ln_s} -nf \ - ./srtrmsql \ - %{_sbindir}/sorter +#generating exec to be path of the /usr/sbin path +for exe in \ + chkspf \ + feeder \ + receiver \ + sender \ + sorter + do + %{__ln_s} -nsf \ + %{_libexecdir}/%{name}/bin-mysql/$exe \ + %{_sbindir} + done case "$OS" in "sysv" | \ @@ -256,6 +257,8 @@ case "$OS" in %postun mysql if [ "$1" = 0 ]; then + rm -f %{_sbindir}/chkspf + rm -f %{_sbindir}/feeder rm -f %{_sbindir}/receiver rm -f %{_sbindir}/sender rm -f %{_sbindir}/sorter