From 9aa77d6829775ab346675e9a090a27db2b3b1c2d Mon Sep 17 00:00:00 2001 From: "fuzhou.chen" Date: Wed, 13 Dec 2023 13:42:38 +0800 Subject: [PATCH] Create static library. This is to allow developer build portable executables (e.g. gaming), that executables can wrap all necessary code into one single binary, instead of maintaining a dependency chain of shared libraries. --- configure | 2 ++ libsndio/Makefile.in | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6aef806..155ed6f 100755 --- a/configure +++ b/configure @@ -36,6 +36,7 @@ END version=1.9.0 # package version (used by pkg-config) prefix=/usr/local # where to install sndio so="libsndio.so.\${MAJ}.\${MIN}" # shared libs to build +static_name="libsndio-static.a" # shared libs to build alsa=no # do we want alsa support ? sun=no # do we want sun support ? oss=no # do we want oss support ? @@ -301,6 +302,7 @@ do -e "s:@ldadd@:$ldadd:" \ -e "s:@so@:$so:" \ -e "s:@so_link@:$so_link:" \ + -e "s:@static@:$static_name:" \ -e "s:@so_ldflags@:$so_ldflags:" \ -e "s:@vars@:${vars}:" \ -e "s:@precision@:$precision:" \ diff --git a/libsndio/Makefile.in b/libsndio/Makefile.in index 6225544..4900ffe 100644 --- a/libsndio/Makefile.in +++ b/libsndio/Makefile.in @@ -50,8 +50,9 @@ MAJ = 7 MIN = 2 SO = @so@ SO_LINK = @so_link@ +STATIC= @static@ -all: ${SO} +all: ${SO} ${STATIC} for i in ${SO_LINK}; do ln -sf ${SO} $$i; done install: @@ -62,6 +63,7 @@ install: mkdir -p ${DESTDIR}${MAN7_DIR} cp sndio.h ${DESTDIR}${INCLUDE_DIR} cp -R ${SO} ${SO_LINK} ${DESTDIR}${LIB_DIR} + cp -R ${STATIC} ${DESTDIR}${LIB_DIR} cp sndio.pc ${DESTDIR}${PKGCONF_DIR} cp sio_open.3 ${DESTDIR}${MAN3_DIR} ln -sf sio_open.3 ${DESTDIR}${MAN3_DIR}/sio_close.3 @@ -127,6 +129,9 @@ getpeereid.o issetugid.o strlcat.o strlcpy.o strtonum.o clock_gettime.o ${SO}: ${OBJS} ${CC} ${LDFLAGS} ${SO_CFLAGS} ${SO_LDFLAGS} -o ${SO} ${OBJS} ${LDADD} +${STATIC}: ${OBJS} + ${AR} r ${STATIC} ${OBJS} + getpeereid.o: ../bsd-compat/getpeereid.c ${CC} ${CFLAGS} ${SO_CFLAGS} ${INCLUDE} ${DEFS} -c -o getpeereid.o ../bsd-compat/getpeereid.c