Skip to content

Commit

Permalink
Create static library.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fuzhouch committed Dec 13, 2023
1 parent 3f8bdef commit 9aa77d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions configure
Expand Up @@ -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 ?
Expand Down Expand Up @@ -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:" \
Expand Down
7 changes: 6 additions & 1 deletion libsndio/Makefile.in
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9aa77d6

Please sign in to comment.