diff --git a/lib/libcurses/Makefile b/lib/libcurses/Makefile index 5f94df842903..5477a68ea390 100644 --- a/lib/libcurses/Makefile +++ b/lib/libcurses/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.91 2019/09/02 09:08:29 roy Exp $ +# $NetBSD: Makefile,v 1.92 2019/09/03 10:36:17 roy Exp $ # @(#)Makefile 8.2 (Berkeley) 1/2/94 .include @@ -210,10 +210,8 @@ SUBDIR.roff+= PSD.doc fileio.h: shlib_version genfileioh.awk ${TOOL_AWK} -f ${.CURDIR}/genfileioh.awk < ${.CURDIR}/shlib_version > ${.CURDIR}/fileio.h -NETBSD_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh -CPPFLAGS.version.c+= -DNETBSD_VERSION=\"${NETBSD_VERSION}\" -.PATH: ${NETBSDSRCDIR}/sys/sys -version.o: param.h +CURSES_VERSION!= ${HOST_SH} ${.CURDIR}/cursesrelease.sh +CPPFLAGS.version.c+= -DCURSES_VERSION=\"${CURSES_VERSION}\" .include .include diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index e11eb647ca1b..1164f0826013 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $NetBSD: curses.h,v 1.124 2019/09/02 09:08:29 roy Exp $ */ +/* $NetBSD: curses.h,v 1.125 2019/09/03 10:36:17 roy Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -47,6 +47,23 @@ #include #include +/* + * #define __NetBSD_Curses_Version__ MMmmrrpp00 + * + * M = major version + * m = minor version; a minor number of 99 indicates current + * r = 0 (*) + * p = patchlevel + * + * This is similar to __NetBSD_Version__ as found in sys/param.h + * It is maintained seperately and has no correlation to it or the + * ELF symver libcurses is built as. + */ +#define __NetBSD_Curses_Version__ 0200000000 /* NetBSD-Curses 2.0.0 */ + +#define __NetBSD_Curses_Prereq__(M,m,p) (((((M) * 100000000) + \ + (m) * 1000000) + (p) * 100) <= __NetBSD_Curses_Version__) + /* * attr_t must be the same size as wchar_t (see ) to avoid padding * in __LDATA. diff --git a/lib/libcurses/cursesrelease.sh b/lib/libcurses/cursesrelease.sh new file mode 100644 index 000000000000..911fcabf29a6 --- /dev/null +++ b/lib/libcurses/cursesrelease.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# $NetBSD: cursesrelease.sh,v 1.1 2019/09/03 10:36:17 roy Exp $ +# +# Copyright (c) 1997 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Luke Mewburn. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# We use the number specified in + +path="$0" +[ "${path#/*}" = "$path" ] && path="./$path" +exec < ${path%/*}/curses.h + +# Search for line +# #define __NetBSD_Curses_Version__ /* NetBSD-Curses */ +# +# and should match! + +while + read define ver_tag rel_num comment_start NetBSD rel_text rest || exit 1 +do + [ "$define" = "#define" ] || continue; + [ "$ver_tag" = "__NetBSD_Curses_Version__" ] || continue + break +done + +# ${rel_num} is [M]Mmm00pp00 +rel_num=${rel_num%??} +rel_MMmm=${rel_num%????} +rel_MM=${rel_MMmm%??} +rel_mm=${rel_MMmm#${rel_MM}} +rel_pp=${rel_num#${rel_MMmm}00} + +echo "${rel_MM#0}.${rel_mm#0}.${rel_pp#0}" diff --git a/lib/libcurses/version.c b/lib/libcurses/version.c index efe60d170f1f..426687756583 100644 --- a/lib/libcurses/version.c +++ b/lib/libcurses/version.c @@ -1,4 +1,4 @@ -/* $NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $ */ +/* $NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $"); +__RCSID("$NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $"); #endif #include "curses.h" @@ -40,5 +40,5 @@ const char * curses_version() { - return "NetBSD-Curses " NETBSD_VERSION; + return "NetBSD-Curses " CURSES_VERSION; }