diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-11 13:49:50 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-11 13:49:50 +0200 |
commit | 339954714f69bbd395aa9bbe46850dcaa98e9f29 (patch) | |
tree | 00b17e206e3acc35303d24f6a1e76bf2de8c5664 /src | |
parent | 08ce54211ce4b8d6092321ca1b28773a680ddc45 (diff) |
convert form make to meson
Add .editorconfig.
Removed unused fallback definitions (for POSIX systems).
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 123 | ||||
-rw-r--r-- | src/TARGETS | 79 | ||||
-rwxr-xr-x | src/configure | 69 | ||||
-rw-r--r-- | src/dnsstub/Makefile | 23 | ||||
-rw-r--r-- | src/dnsstub/TARGETS | 18 | ||||
-rw-r--r-- | src/dnsstub/meson.build | 24 | ||||
-rw-r--r-- | src/meson.build | 74 | ||||
-rwxr-xr-x | src/sharedlib | 2 |
8 files changed, 98 insertions, 314 deletions
diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 8426968..0000000 --- a/src/Makefile +++ /dev/null @@ -1,123 +0,0 @@ -# Makefile for qlibs - -SHELL=/bin/sh - -# static flags - DO NOT EDIT! -CCFLAGS=-Iinclude - -SRCS=*.c -OBJS=*.o -COMPILE=./compile -MAKELIB=./makelib -SHAREDLIB=./sharedlib - -default: clean check libs - -check: - @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ./configure - -clean: - @echo -n Cleaning up libs ... - @rm -f `cat TARGETS` - @cd dnsstub ; make -s clean ; cd .. - @echo " done!" - -core: alloc.a buffer.a case.a cdb.a constmap.a env.a \ -fd.a fs.a getln.a getopt.a lock.a logmsg.a ndelay.a open.a \ -seek.a sig.a str.a stralloc.a time.a wait.a \ -ip.a socket.a dnsresolv.a - -libs: obj core qlibs.a dnsresolv.a - -obj: - @echo Making all in qlibs ... - $(COMPILE) $(CCFLAGS) $(CFLAGS) $(SRCS) - -install: setup - -setup: - @./install - -shared: $(COMPILE) $(SHAREDLIB) $(OBJS) ./dnsstub/$(OBJS) - @echo Building shared qlibs ... - $(SHAREDLIB) $(LDFLAGS) $(OBJS) -o libqlibs.so - $(SHAREDLIB) $(LDFLAGS) ./dnsstub/$(OBJS) -o libdnsresolv.so - -qlibs.a: obj socket.a - $(MAKELIB) $(LDFLAGS) qlibs.a *.o - ln -sf qlibs.a libqlibs.a - -dnsresolv.a: - @echo "Building @dnsresolv lib ..." - @cd dnsstub ; make - @cp dnsstub/dnsresolv.a dnsresolv.a - ln -sf dnsresolv.a libdnsresolv.a - -socket.a: ip.a - @echo "Building socket lib ..." - $(MAKELIB) $(LDFLAGS) socket.a socket_if.o socket_bind.o socket_connect.o \ - socket_info.o socket_setup.o socket_tcp.o socket_udp.o ip.a - -# build each file separately (backwards compat) - better use recipe qlibs.a -alloc.a: alloc.o - $(MAKELIB) $(LDFLAGS) alloc.a alloc.o - -buffer.a: buffer.o - $(MAKELIB) $(LDFLAGS) buffer.a buffer.o - -case.a: case.o - $(MAKELIB) $(LDFLAGS) case.a case.o - -cdb.a: cdbread.o cdbmake.o uint32p.o seek.o buffer.o - $(MAKELIB) $(LDFLAGS) cdb.a cdbread.o cdbmake.o uint32p.o seek.o buffer.o - -constmap.a: constmap.o alloc.o buffer.o scan.o - $(MAKELIB) $(LDFLAGS) constmap.a constmap.o alloc.o buffer.o scan.o - -env.a: env.o - $(MAKELIB) $(LDFLAGS) env.a env.o - -fd.a: fd.o - $(MAKELIB) $(LDFLAGS) fd.a fd.o - -fs.a: fmt.o scan.o - $(MAKELIB) $(LDFLAGS) fs.a fmt.o scan.o - -getln.a: getln.o - $(MAKELIB) $(LDFLAGS) getln.a getln.o - -getopt.a: getoptb.o - $(MAKELIB) $(LDFLAGS) getopt.a getoptb.o - -ip.a: ip4.o ip6.o socket_if.o - $(MAKELIB) $(LDFLAGS) ip.a ip4.o ip6.o socket_if.o - -lock.a: lock.o - $(MAKELIB) $(LDFLAGS) lock.a lock.o - -ndelay.a: ndelay.o - $(MAKELIB) $(LDFLAGS) ndelay.a ndelay.o - -open.a: open.o - $(MAKELIB) $(LDFLAGS) open.a open.o - -seek.a: seek.o - $(MAKELIB) $(LDFLAGS) seek.a seek.o - -sig.a: sig.o - $(MAKELIB) $(LDFLAGS) sig.a sig.o - -str.a: str.o byte.o stralloc.o alloc.o - $(MAKELIB) $(LDFLAGS) str.a str.o byte.o stralloc.o alloc.o - -stralloc.a: stralloc.o alloc.o - $(MAKELIB) $(LDFLAGS) stralloc.a stralloc.o alloc.o - -logmsg.a: errstr.o logmsg.o - $(MAKELIB) $(LDFLAGS) logmsg.a errstr.o logmsg.o - -time.a: iopause.o tai.o taia.o timeout.o timeoutconn.o - $(MAKELIB) $(LDFLAGS) time.a iopause.o tai.o taia.o timeout.o timeoutconn.o - -wait.a: wait.o - $(MAKELIB) $(LDFLAGS) wait.a wait.o diff --git a/src/TARGETS b/src/TARGETS deleted file mode 100644 index df6d6ee..0000000 --- a/src/TARGETS +++ /dev/null @@ -1,79 +0,0 @@ -alloc.a -alloc.o -base64.o -buffer.a -buffer.o -byte.o -case.a -case.o -cdb.a -cdbmake.o -cdbread.o -constmap.a -constmap.o -compile -dnsresolv.a -env.a -env.o -errstr.o -fd.a -fd.o -fmt.o -fs.a -getln.a -getln.o -getopt.a -getoptb.o -iopause.o -ip.a -ip4.o -ip6.o -libdnsresolv.a -libqlibs.a -lock.a -lock.o -logmsg.a -logmsg.o -makelib -ndelay.a -ndelay.o -open.a -open.o -pathexec.o -prot.o -qlibs.a -readclose.o -scan.o -seek.a -seek.o -sig.a -sig.o -socket.a -socket_bind.o -socket_connect.o -socket_if.o -socket_info.o -socket_recv.o -socket_send.o -socket_setup.o -socket_tcp.o -socket_udp.o -str.a -str.o -stralloc.a -stralloc.o -sysmsg.o -tai.o -taia.o -time.a -timeout.o -timeoutconn.o -uint128p.o -uint16p.o -uint32p.o -uint64p.o -uint8p.o -wait.a -wait.o -libdnsresolv.so -libqlibs.so diff --git a/src/configure b/src/configure deleted file mode 100755 index 47b0f08..0000000 --- a/src/configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -#******************************************************************************** -# Very simple configure script for qlibs - -. ../conf-build -# Add $HDRDIR as include option to default $CFLAGS -[ "$HDRDIR" ] && CFLAGS="$CFLAGS -I$HDRDIR" - -#******************************************************************************** -# check for system header files -# -# Usually, 'select.h' should (have to) be in this location ... -SELECT_H="/usr/include/sys/select.h" -echo -n "Checking for select.h ..." -if [ -f $SELECT_H ] ; then CFLAGS="$CFLAGS -DHAS_SELECT_H" - else echo -n " not" ; fi -echo " found!" - -# On linux we have flock, other systems have lockf instead -echo -n "Checking for flock/lockf ..." -which flock 2>/dev/null >/dev/null -if [ $? -eq 0 ] ; then CCOPTS="$CFLAGS -DHASFLOCK=1" ; echo -n " flock" - else echo -n " lockf" ; fi -echo " found!" - -# Current systems provide a poll interface ... via -POLL_H="/usr/include/poll.h" -POLL_H1="/usr/include/sys/poll.h" -echo -n "Checking for poll.h ..." -if [ -f $POLL_H -o -f $POLL_H1 ] ; then CFLAGS="$CFLAGS -DHAS_POLL_H" - else echo -n " not" ; fi -echo " found!" - -# Current systems support for 8 and 64 bit integers ... via -STDINT_H="/usr/include/stdint.h" -echo -n "Checking for uint8_t ..." -if [ `grep -c uint_least8_t $STDINT_H` ] ; then CFLAGS="$CFLAGS -DHAS_UINT8_H" - else echo -n " not" ; fi -echo " found!" -echo -n "Checking for uint64_t ..." -if [ `grep -c uint_least64_t $STDINT_H` ] ; then CFLAGS="$CFLAGS -DHAS_UINT64_H" - else echo -n " not" ; fi -echo " found!" - -#******************************************************************************** -# Create compile, load, makelib, sharedlib -echo -n "Checking for compile ... " -CC="cc" -( echo '#!/bin/sh' - echo exec "$CC" "$CFLAGS" -c '${1+"$@"}' ) > compile -chmod 755 compile -echo " created!" - -echo -n "Checking for makelib ... " -( echo '#!/bin/sh' ; - echo "" ; - echo 'main="$1"; shift' ; \ - echo 'rm -f "$main"' ; \ - echo 'ar cr "$main" ${1+"$@"}' ; \ - echo 'ranlib "$main"') > makelib -chmod 755 makelib -echo " created!" - -echo -n "Checking for sharedlib ... " -CC="cc" -( echo '#!/bin/sh' - echo exec "$CC" -shared '${1+"$@"}' ) > sharedlib -chmod 755 sharedlib -echo " created!" diff --git a/src/dnsstub/Makefile b/src/dnsstub/Makefile deleted file mode 100644 index ee7f94d..0000000 --- a/src/dnsstub/Makefile +++ /dev/null @@ -1,23 +0,0 @@ - -COMPILE=../compile -MAKELIB=../makelib -CCFLAGS=-I../../include - -default: clean check dnsresolv.a - -check: - @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ( cd .. ; ./configure ; ) - -clean: - rm -f `cat TARGETS` - -dnsresolv.a: \ -dns_domain.c dns_dtda.c dns_ip.c dns_ipq.c dns_name.c \ -dns_nd.c dns_packet.c dns_random.c dns_rcip.c dns_rcrw.c dns_resolve.c \ -dns_sortip.c dns_transmit.c dns_txt.c - $(COMPILE) $(CCFLAGS) dns_domain.c dns_dfd.c dns_dtda.c dns_ip.c dns_ipq.c \ - dns_mx.c dns_name.c dns_nd.c dns_packet.c dns_random.c dns_rcip.c \ - dns_rcrw.c dns_resolve.c dns_sortip.c dns_transmit.c dns_txt.c dns_cname.c - $(MAKELIB) dnsresolv.a dns_domain.o dns_dfd.o dns_dtda.o dns_ip.o dns_ipq.o \ - dns_mx.o dns_name.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o \ - dns_rcrw.o dns_resolve.o dns_sortip.o dns_transmit.o dns_txt.o dns_cname.o diff --git a/src/dnsstub/TARGETS b/src/dnsstub/TARGETS deleted file mode 100644 index 62f40be..0000000 --- a/src/dnsstub/TARGETS +++ /dev/null @@ -1,18 +0,0 @@ -dns_cname.o -dns_dfd.o -dns_domain.o -dns_dtda.o -dns_ip.o -dns_ipq.o -dns_mx.o -dns_name.o -dns_nd.o -dns_packet.o -dns_random.o -dns_rcip.o -dns_rcrw.o -dns_resolve.o -dns_sortip.o -dns_transmit.o -dns_txt.o -dnsresolv.a diff --git a/src/dnsstub/meson.build b/src/dnsstub/meson.build new file mode 100644 index 0000000..e1a6cf0 --- /dev/null +++ b/src/dnsstub/meson.build @@ -0,0 +1,24 @@ +dnsresolv_srcs = [ + 'dns_cname.c', + 'dns_dfd.c', + 'dns_domain.c', + 'dns_dtda.c', + 'dns_ip.c', + 'dns_ipq.c', + 'dns_mx.c', + 'dns_name.c', + 'dns_nd.c', + 'dns_packet.c', + 'dns_random.c', + 'dns_rcip.c', + 'dns_rcrw.c', + 'dns_resolve.c', + 'dns_sortip.c', + 'dns_transmit.c', + 'dns_txt.c', +] + +dnsresolv_lib = library('dnsresolv', dnsresolv_srcs, + install : true, + link_with : qlibs_lib, + include_directories : qlibs_inc) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..03e3c01 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,74 @@ +cdb_srcs = [ + 'buffer.c', + 'cdbmake.c', + 'cdbread.c', + 'uint32p.c', + 'seek.c', +] +cmap_srcs = ['alloc.c', 'buffer.c', 'constmap.c', 'scan.c'] +fs_srcs = ['fmt.c', 'scan.c'] +ip_srcs = ['ip4.c', 'ip6.c', 'socket_if.c'] +str_srcs = ['alloc.c', 'byte.c', 'str.c', 'stralloc.c'] +logmsg_srcs = ['errstr.c', 'logmsg.c'] +time_srcs = ['iopause.c', 'tai.c', 'taia.c', 'timeout.c', 'timeoutconn.c'] +pack_srcs = ['uint8p.c', 'uint16p.c', 'uint32p.c', 'uint64p.c', 'uint128p.c'] + +socket_srcs = [ + 'socket_bind.c', + 'socket_connect.c', + 'socket_if.c', + 'socket_info.c', + 'socket_setup.c', + 'socket_tcp.c', + 'socket_udp.c', + + 'socket_recv.c', + 'socket_send.c', +] +socket_srcs += ['ndelay.c', 'uint16p.c'] +socket_srcs += ip_srcs +socket_srcs += str_srcs +socket_srcs += fs_srcs + +socket_lib = library('socket', socket_srcs, + include_directories : qlibs_inc, + build_by_default : false) + +other_srcs = [ + 'base64.c', + 'case.c', + 'env.c', + 'fd.c', + 'getln.c', + 'getoptb.c', + 'lock.c', + 'ndelay.c', + 'open.c', + 'pathexec.c', + 'prot.c', + 'readclose.c', + 'sig.c', + 'wait.c', +] + +core_srcs = other_srcs +core_srcs += cdb_srcs +core_srcs += cmap_srcs +core_srcs += fs_srcs +core_srcs += ip_srcs +core_srcs += logmsg_srcs +core_srcs += str_srcs +core_srcs += time_srcs +core_srcs += socket_srcs +core_srcs += pack_srcs + +cc = meson.get_compiler('c') + +qlibs_c_args = cc.has_header_symbol('sys/file.h', 'flock') ? '-DHASFLOCK' : '' + +qlibs_lib = library('qlibs', core_srcs, + install : true, + c_args : qlibs_c_args, + include_directories : qlibs_inc) + +subdir('dnsstub') diff --git a/src/sharedlib b/src/sharedlib deleted file mode 100755 index 3bf4f26..0000000 --- a/src/sharedlib +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec cc -shared ${1+"$@"} |