Put exported symbols of libz under our own control
authortb <tb@openbsd.org>
Fri, 2 Aug 2024 04:59:23 +0000 (04:59 +0000)
committertb <tb@openbsd.org>
Fri, 2 Aug 2024 04:59:23 +0000 (04:59 +0000)
This adds a Symbols.list containing the exported symbols like in other
libraries in base. If upstream adds new API this won't necessarily need
a bump on our side.

help/ok kettenis

lib/libz/Makefile
lib/libz/Symbols.list [new file with mode: 0644]

index 19f8589..c358f4d 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.22 2024/01/21 07:33:46 tb Exp $
+#      $OpenBSD: Makefile,v 1.23 2024/08/02 04:59:23 tb Exp $
 
 LIB=   z
 HDRS=  zconf.h zlib.h
@@ -7,6 +7,11 @@ SRCS=  adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c \
        trees.c uncompr.c zutil.c
 MAN=   compress.3
 
+VERSION_SCRIPT=        Symbols.map
+SYMBOL_LIST=   ${.CURDIR}/Symbols.list
+
+CLEANFILES+=   ${VERSION_SCRIPT}
+
 PC_FILES=zlib.pc
 CLEANFILES+=${PC_FILES}
 
@@ -29,4 +34,9 @@ beforeinstall:
        ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
            -m ${SHAREMODE} ${.OBJDIR}/${PC_FILES} ${DESTDIR}/usr/lib/pkgconfig/
 
+${VERSION_SCRIPT}: ${SYMBOL_LIST}
+       { printf '{\n\tglobal:\n'; \
+         sed '/^[._a-zA-Z]/s/$$/;/; s/^/               /' ${SYMBOL_LIST}; \
+         printf '\n\tlocal:\n\t\t*;\n};\n'; } >$@.tmp && mv $@.tmp $@
+
 .include <bsd.lib.mk>
diff --git a/lib/libz/Symbols.list b/lib/libz/Symbols.list
new file mode 100644 (file)
index 0000000..5e04879
--- /dev/null
@@ -0,0 +1,90 @@
+adler32
+adler32_combine
+adler32_combine64
+adler32_z
+compress
+compress2
+compressBound
+crc32
+crc32_combine
+crc32_combine64
+crc32_combine_gen
+crc32_combine_gen64
+crc32_combine_op
+crc32_z
+deflate
+deflateBound
+deflateCopy
+deflateEnd
+deflateGetDictionary
+deflateInit2_
+deflateInit_
+deflateParams
+deflatePending
+deflatePrime
+deflateReset
+deflateResetKeep
+deflateSetDictionary
+deflateSetHeader
+deflateTune
+deflateUsed
+get_crc_table
+gzbuffer
+gzclearerr
+gzclose
+gzclose_r
+gzclose_w
+gzdirect
+gzdopen
+gzeof
+gzerror
+gzflush
+gzfread
+gzfwrite
+gzgetc
+gzgetc_
+gzgets
+gzoffset
+gzoffset64
+gzopen
+gzopen64
+gzprintf
+gzputc
+gzputs
+gzread
+gzrewind
+gzseek
+gzseek64
+gzsetparams
+gztell
+gztell64
+gzungetc
+gzvprintf
+gzwrite
+inflate
+inflateBack
+inflateBackEnd
+inflateBackInit_
+inflateCodesUsed
+inflateCopy
+inflateEnd
+inflateGetDictionary
+inflateGetHeader
+inflateInit2_
+inflateInit_
+inflateMark
+inflatePrime
+inflateReset
+inflateReset2
+inflateResetKeep
+inflateSetDictionary
+inflateSync
+inflateSyncPoint
+inflateUndermine
+inflateValidate
+uncompress
+uncompress2
+zError
+z_errmsg
+zlibCompileFlags
+zlibVersion