]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Standard way to compile exec integrated to mailleur rpm spec file
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 12 Jul 2025 18:04:05 +0000 (14:04 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 12 Jul 2025 18:04:05 +0000 (14:04 -0400)
Makefile
app/Makefile
app/Makefile-postgres [new file with mode: 0644]
mailleur.spec.in

index 7b4778fcdcb1dbae873c969854fec4d2edecf343..f65a9923d49448eaa38f12d4e85e2a282de235ce 100644 (file)
--- 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)
 #--------------------------------------------------------------------
index 9652a900cbd8dd2a71dbfeb409f56d2c674bcc2d..19fbe4cff8d93481f28804fa63a215408e3146e9 100644 (file)
@@ -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 (file)
index 0000000..95e6765
--- /dev/null
@@ -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
+#--------------------------------------------------------------------
index 30e1e36bd7bb8a10594a9815e411e064d66aea71..5e0654737fda76c2f3024bcceaca7057d0d50798 100644 (file)
@@ -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