summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-11 13:49:50 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-11 13:49:50 +0200
commit339954714f69bbd395aa9bbe46850dcaa98e9f29 (patch)
tree00b17e206e3acc35303d24f6a1e76bf2de8c5664
parent08ce54211ce4b8d6092321ca1b28773a680ddc45 (diff)
convert form make to meson
Add .editorconfig. Removed unused fallback definitions (for POSIX systems).
-rw-r--r--.editorconfig15
-rw-r--r--[-rwxr-xr-x]CONTENT0
-rw-r--r--conf-build30
-rw-r--r--include/iopause.h16
-rw-r--r--include/meson.build52
-rw-r--r--include/select.h14
-rwxr-xr-xinstall14
-rw-r--r--man/INSTALL12
-rw-r--r--man/meson.build53
-rw-r--r--man/x.html99
-rw-r--r--meson.build18
-rw-r--r--meson.options2
-rw-r--r--src/Makefile123
-rw-r--r--src/TARGETS79
-rwxr-xr-xsrc/configure69
-rw-r--r--src/dnsstub/Makefile23
-rw-r--r--src/dnsstub/TARGETS18
-rw-r--r--src/dnsstub/meson.build24
-rw-r--r--src/meson.build74
-rwxr-xr-xsrc/sharedlib2
20 files changed, 242 insertions, 495 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..51e7219
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+trim_trailing_whitespace = true
+
+[*.{c,h}]
+indent_style = space
+indent_size = 2
+
+[meson.build]
+indent_style = space
+indent_size = 2
diff --git a/CONTENT b/CONTENT
index 25fa27d..25fa27d 100755..100644
--- a/CONTENT
+++ b/CONTENT
diff --git a/conf-build b/conf-build
deleted file mode 100644
index 897c50d..0000000
--- a/conf-build
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-# Build and install options for qlibs
-#
-#********************************************************************************
-# default compiler flags - usually this shouldn't be changed
-CFLAGS='-O2 -Iinclude -fPIC -Wall'
-
-# under OmniOS the binaries are build as 32 bit version; except enabling this:
-#CFLAGS='-O2 -Iinclude -Wall -fPIC -m64'
-
-# You can check the ELFCLASS while calling eg.: 'file open.o'.
-#********************************************************************************
-# destination folder(s) (install options of qlibs)
-#
-# Define a destination where libs and/or header files will be installed into. If
-# a var is empty, then nothing will be installed (copied). The term 'libs' here
-# means all '*.a' files and additional all files given by $OFILES (see below).
-# Example 1:
-# LIBDIR=.. - copy all libs into the upper folder
-# HDRDIR= - don't copy header files ('*.h')
-# Example 2:
-# LIBDIR=/usr/local/lib - copy all libs into /usr/local/lib
-# HDRDIR=$LIBDIR/include - copy all header files into /usr/local/lib/include
-#
-LIBDIR=..
-HDRDIR=../include/
-
-#********************************************************************************
-# Additional libs (object files, delimited by space, enclosed in "'")
-OFILES='base64.o byte.o fmt.o prot.o pathexec.o readclose.o scan.o constmap.o'
diff --git a/include/iopause.h b/include/iopause.h
index 871c8eb..488c840 100644
--- a/include/iopause.h
+++ b/include/iopause.h
@@ -3,22 +3,12 @@
#define IOPAUSE_POLL
+#include <poll.h>
#include <sys/types.h>
-#ifdef HAS_POLL_H
- #include <poll.h>
typedef struct pollfd iopause_fd;
- #define IOPAUSE_READ POLLIN
- #define IOPAUSE_WRITE POLLOUT
-#else
-typedef struct {
- int fd;
- short events;
- short revents;
-} iopause_fd;
- #define IOPAUSE_READ 1
- #define IOPAUSE_WRITE 4
-#endif
+#define IOPAUSE_READ POLLIN
+#define IOPAUSE_WRITE POLLOUT
#include "taia.h"
diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 0000000..42439fd
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,52 @@
+qlibs_inc = include_directories('.')
+
+qlibs_hdrs = [
+ 'alloc.h',
+ 'base64.h',
+ 'buffer.h',
+ 'byte.h',
+ 'case.h',
+ 'cdbmake.h',
+ 'cdbread.h',
+ 'close.h',
+ 'constmap.h',
+ 'direntry.h',
+ 'dnsresolv.h',
+ 'env.h',
+ 'error.h',
+ 'exit.h',
+ 'fd.h',
+ 'fifo.h',
+ 'fmt.h',
+ 'genalloc.h',
+ 'getln.h',
+ 'getoptb.h',
+ 'iopause.h',
+ 'ip.h',
+ 'lock.h',
+ 'logmsg.h',
+ 'ndelay.h',
+ 'open.h',
+ 'pathexec.h',
+ 'prot.h',
+ 'readclose.h',
+ 'readwrite.h',
+ 'rename.h',
+ 'scan.h',
+ 'seek.h',
+ 'select.h',
+ 'sig.h',
+ 'socket_if.h',
+ 'stralloc.h',
+ 'str.h',
+ 'taia.h',
+ 'tai.h',
+ 'timeoutconn.h',
+ 'timeout.h',
+ 'uint_t.h',
+ 'wait.h',
+]
+
+qlibs_hdr_subdir = 'fehqlibs'
+
+install_headers(qlibs_hdrs, subdir : qlibs_hdr_subdir)
diff --git a/include/select.h b/include/select.h
index 7257ddd..41bfcb7 100644
--- a/include/select.h
+++ b/include/select.h
@@ -1,13 +1 @@
-#ifndef SELECT_H
-#define SELECT_H
-
-#include <sys/time.h>
-#include <sys/types.h>
-
-#ifdef HAS_SELECT_H
- #include <sys/select.h>
-#endif
-
-extern int select();
-
-#endif
+#include <sys/select.h>
diff --git a/install b/install
deleted file mode 100755
index b30bf6b..0000000
--- a/install
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-. ./conf-build
-
-install_libs() { cp src/*.a $OFILES "$LIBDIR" ; }
-install_hdrs() { cp include/*.h "$HDRDIR" ; }
-
-echo -n "Installing qlibs ..."
-mkdir -p "$LIBDIR" "$HDRDIR" 2>/dev/null
-
-[ "$LIBDIR" ] && install_libs
-[ "$HDRDIR" ] && install_hdrs
-
-echo " done!"
diff --git a/man/INSTALL b/man/INSTALL
deleted file mode 100644
index 7281ed9..0000000
--- a/man/INSTALL
+++ /dev/null
@@ -1,12 +0,0 @@
-Imstallation of fehQlibs man pages
-==================================
-
-a) It is expected that the fehQlibs are installed at /usr/local.
-b) Check your manpath settings: $ manpath
-c) You might want to compress the manpages: gzip *.3
-d) If available, the compressed or raw man pages can be simply copied to
- - /usr/local/man/man3 or
- - /usr/local/share/man/man3
- 'root' is required to complete this step.
-
-That's it!
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..53c6a41
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,53 @@
+qlibs_mans = [
+ 'alloc.3',
+ 'buffer.3',
+ 'byte.3',
+ 'case.3',
+ 'cdbmake.3',
+ 'cdbread.3',
+ 'constmap.3',
+ 'dns.3',
+ 'dnsstub.3',
+ 'env.3',
+ 'error.3',
+ 'fd.3',
+ 'fmt.3',
+ 'getln.3',
+ 'getoptb.3',
+ 'iopause.3',
+ 'ip4.3',
+ 'ip6.3',
+ 'logmsg.3',
+ 'pathexec.3',
+ 'scan.3',
+ 'socket_bind.3',
+ 'socket_connect.3',
+ 'socket_if.3',
+ 'socket_info.3',
+ 'socket_recv.3',
+ 'socket_send.3',
+ 'socket_setup.3',
+ 'socket_tcp.3',
+ 'socket_udp.3',
+ 'str.3',
+ 'stralloc.3',
+ 'taia.3',
+ 'timeout.3',
+ 'timeoutconn.3',
+ 'wait.3',
+]
+
+man_section = get_option('man_section')
+renamed = []
+
+foreach m : qlibs_mans
+ if m.endswith('.3')
+ renamed += m.substring(0, -1) + man_section
+ endif
+endforeach
+
+install_data(
+ sources : qlibs_mans,
+ rename : renamed,
+ install_tag : 'man',
+ install_dir : get_option('mandir') / ('man' + man_section))
diff --git a/man/x.html b/man/x.html
deleted file mode 100644
index 224edc1..0000000
--- a/man/x.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<HTML>
-<BODY>
-<PRE>
-<!-- Manpage converted by man2html 3.0.1 -->
-SYNTAX
- #include "logmsg.h"
-
- int logmsg(const char *who, int ecode, unsigned int classs, char *msg)
-
- err_sys(w,e) logmsg(w,e,FATAL,"")
- err_sys_plus(w,e,m) logmsg(w,e,FATAL,m)
- err_tmp(w,e) logmsg(w,e,WARN,"")
- err_tmp_plus(w,e,m) logmsg(w,e,WARN,m)
- err_int(w,e,c) logmsg(w,e,c,"")
- err_int_plus(w,e,c,m) logmsg(w,e,c,m)
- log_who(w,m) logmsg(w,0,LOG,m)
- log_anon(m) logmsg("",0,LOG,m)
-
-DESCRIPTION
- logmsg prints error, warning, or info/logging messages to stderr and
- potentially terminates the calling program, depending on the class
- given. who is the name of the program, ecode is an error code, class
- determines the behavior upon call and msg is the logging message. Read
- "error.h" to learn more about related constants.
-
-ECODE
- ecode is the error code and subject to be displayed in the log file and
- potentially used upon exit if the class equals ERROR, FATAL, or DROP.
-
- To avoid conflicts with syscall error codes, appplication defined error
- codes should be negative. The values -15, -100 and -111 are reserved
- for backward compatibility.
-
-CLASS
- The class parameter indicates how the application handles exceptions
- and displays the log message.
-
- o LOG, INFO, ALERT, WARN - display message and continue operation
-
- o DROP - display warning message and continue while returning to the
- calling program
-
- o USAGE, SYNTAX, FATAL, ERROR - display error message and exit appli‐
- cation with error code
-
- INFO, ALERT, WARN, DROP, USAGE, and FATAL as well as ERROR display the
- respective class string like warning: in the log message, while LOG
- shows the log message only.
-
- The class FATAL should be used for system error codes only, rather ER‐
- ROR and WARN shall be set in conjunction with an application er‐
- ror/warning.
-
-MESSAGE
- If the custom message msg is given, it will be printed additionally.
-
- Dan Bernstein used sets of strerr_dieY*() and strerr_warnY() messages
- which explicitely determine the message and behavior class. Other
- classes were occasionally defined on demand, such als usage().
-
- Kai Peter introduced the errmsg facility in his qlibs including a sys‐
- log compliant severity as second parameter.
-
-EXAMPLES
- The macro definitions uses w for the calling program, e for error
- code, c for class, and m for message.
-
- #include "logmsg.h"
- #define WHO "my_prog"
-
- err_sys(WHO,errno);
- err_sys_plus(WHO,-111,"additional message");
-
- err_tmp("",-100);
- err_tmp_plus("",errno,"additional message");
-
- log_who(WHO,"message");
-
- log_anon() is like log_who() but doesn't print the caller name.
-
- An user defined message s can be build from multiple arguments by using
- the B (build) macro:
-
- err_sys_plus((errno),B("unable to run: ",*argv));
-
-SEE ALSO
- <B>syslog(3)</B>
-
-
-
- 3 qlibs:(logmsg)
-</PRE>
-<HR>
-<ADDRESS>
-Man(1) output converted with
-<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
-</ADDRESS>
-</BODY>
-</HTML>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..0fef8bb
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,18 @@
+project('fehqlibs', 'c',
+ meson_version : '>=1.1.0',
+ version : run_command('cut', '-f2', '-d-', 'VERSION', check : true).stdout().strip(),
+ license : 'CUSTOM',
+ license_files : 'LICENSE',
+ default_options : ['c_std=gnu99'])
+
+subdir('include')
+subdir('src')
+subdir('man')
+
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(qlibs_lib, subdirs : qlibs_hdr_subdir)
+pkg_mod.generate(dnsresolv_lib, subdirs : qlibs_hdr_subdir)
+
+qlibs_dep = declare_dependency(link_with : qlibs_lib, include_directories : qlibs_inc)
+qlibs_socket_dep = declare_dependency(link_with : socket_lib, include_directories : qlibs_inc)
+qlibs_dnsresolv_dep = declare_dependency(link_with : dnsresolv_lib, include_directories : qlibs_inc)
diff --git a/meson.options b/meson.options
new file mode 100644
index 0000000..cd44ca3
--- /dev/null
+++ b/meson.options
@@ -0,0 +1,2 @@
+# man pages are likely to collide with system provided ones like `error.3`
+option('man_section', type : 'string', value : '3q', description : 'Install man pages into this section')
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+"$@"}