summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2019-12-10 19:21:47 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-06-02 12:32:36 +0200
commit7e5e25e44628c407916ca9774a32f0d349dbfe69 (patch)
treedc20ef187e4d7566dcb31d2abb628f314266eb39
parentf827bf6c4e5f2aaaccc08361e0a63ac2e087f831 (diff)
#970 autotools support for ogAdmServer
To build and to install ogAdmServer: autoreconf -fi ./configure make make install Default prefix is /opt/opengnsys/ as usual. ogAdmServer uses autotools for compilation, so this patch adapts OpenGnsys updater and installer to use autotools for compilation.
-rw-r--r--admin/Sources/Services/ogAdmServer/Makefile38
-rw-r--r--admin/Sources/Services/ogAdmServer/Makefile.am6
-rw-r--r--admin/Sources/Services/ogAdmServer/configure.ac25
-rwxr-xr-xinstaller/opengnsys_installer.sh2
-rwxr-xr-xinstaller/opengnsys_update.sh2
5 files changed, 33 insertions, 40 deletions
diff --git a/admin/Sources/Services/ogAdmServer/Makefile b/admin/Sources/Services/ogAdmServer/Makefile
deleted file mode 100644
index 0c3360e6..00000000
--- a/admin/Sources/Services/ogAdmServer/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# makefile
-
-# Nombre del proyecto
-PROYECTO := ogAdmServer
-
-# Directorio de instalaciĆ³n
-INSTALL_DIR := /opt/opengnsys
-
-# Opciones de compilacion
-CFLAGS := $(shell mysql_config --cflags)
-CFLAGS += -g -Wall -I../../Includes
-
-# Opciones de linkado
-LDFLAGS := -Wl,--no-as-needed $(shell mysql_config --libs) -lev -ljansson -ldbi
-
-# Ficheros objetos
-OBJS := sources/ogAdmServer.o sources/dbi.o
-
-
-all: $(PROYECTO)
-
-$(PROYECTO): $(OBJS)
- gcc $(LDFLAGS) $(CFLAGS) $(OBJS) -o $(PROYECTO)
-
-install: $(PROYECTO)
- cp $(PROYECTO) $(INSTALL_DIR)/sbin
- cp $(PROYECTO).cfg $(INSTALL_DIR)/etc
-
-clean:
- rm -f $(PROYECTO) $(OBJS)
-
-uninstall: clean
- rm -f /usr/local/sbin/$(PROYECTO) /usr/local/etc/$(PROYECTO).cfg
-
-sources/%.o: sources/%.c
- gcc $(CFLAGS) -c -o"$@" "$<"
-
-
diff --git a/admin/Sources/Services/ogAdmServer/Makefile.am b/admin/Sources/Services/ogAdmServer/Makefile.am
new file mode 100644
index 00000000..393f3e9e
--- /dev/null
+++ b/admin/Sources/Services/ogAdmServer/Makefile.am
@@ -0,0 +1,6 @@
+sbin_PROGRAMS = ogAdmServer
+
+AM_CFLAGS = -I../../Includes ${LIBDBI_CFLAGS} ${LIBJANSSON_CFLAGS} ${LIBEVENT_CFLAGS} -g -Wall
+
+ogAdmServer_SOURCES= sources/ogAdmServer.c \
+ sources/dbi.c
diff --git a/admin/Sources/Services/ogAdmServer/configure.ac b/admin/Sources/Services/ogAdmServer/configure.ac
new file mode 100644
index 00000000..e7014b53
--- /dev/null
+++ b/admin/Sources/Services/ogAdmServer/configure.ac
@@ -0,0 +1,25 @@
+AC_INIT(ogAdmServer, 1.1.1, opengnsys-devel@listas.unizar.es)
+AC_CONFIG_AUX_DIR([build-aux])
+AC_PREFIX_DEFAULT(/opt/opengnsys)
+
+AC_CANONICAL_HOST
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax no-dist-gzip dist-bzip2 1.6])
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+case "$host" in
+*-*-linux*) ;;
+*) AC_MSG_ERROR([Linux only, sorry!]);;
+esac
+
+AC_CHECK_LIB([jansson], [json_object], , AC_MSG_ERROR([libjansson not found]))
+AC_CHECK_LIB([dbi], [dbi_initialize], , AC_MSG_ERROR([libdbi not found]))
+AC_CHECK_LIB([ev], [ev_loop_new], , AC_MSG_ERROR([libev not found]))
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index d9cf7a82..88f4b0d1 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -1328,7 +1328,7 @@ function servicesCompilation ()
# Compilar OpenGnsys Server
echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Server"
pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer
- make && mv ogAdmServer $INSTALL_TARGET/sbin
+ autoreconf -fi && ./configure && make && mv ogAdmServer $INSTALL_TARGET/sbin
if [ $? -ne 0 ]; then
echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server"
hayErrores=1
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index 38f8069c..70d612c9 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -1046,7 +1046,7 @@ function compileServices()
# Compilar OpenGnsys Server
echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server"
pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer
- make && moveNewService ogAdmServer $INSTALL_TARGET/sbin
+ autoreconf -fi && ./configure && make && moveNewService ogAdmServer $INSTALL_TARGET/sbin
if [ $? -ne 0 ]; then
echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server"
hayErrores=1