Change to build and install rsaref using libtool. No more NetBSD-custom

Makefile or dynamic-PLIST headaches.  Make use of automatic shared library
handling.  Split patches into separate files.
This commit is contained in:
tv 1998-07-14 18:48:37 +00:00
parent 2147c4af71
commit da4de72e19
10 changed files with 176 additions and 137 deletions

View file

@ -1,21 +1,25 @@
# $NetBSD: Makefile,v 1.7 1998/05/29 19:57:27 tv Exp $
# $NetBSD: Makefile,v 1.8 1998/07/14 18:48:37 tv Exp $
#
DISTNAME= rsaref20
PKGNAME= rsaref-2.0
WRKSRC= ${WRKDIR}/source
WRKSRC= ${WRKDIR}/install
MAKEFILE= unix/makefile
CATEGORIES= security
MASTER_SITES= ${RSA_SITE}
EXTRACT_SUFX= .tar.Z
MAINTAINER= packages@NetBSD.ORG
MAINTAINER= tv@netbsd.org
BUILD_DEPENDS= ${PREFIX}/bin/libtool:../../devel/libtool
RESTRICTED= "Cryptographic source usable only within the USA"
MIRROR_DISTFILE= no
IS_INTERACTIVE= yes
ALL_TARGET= librsaref.la
RSA_SITE= ftp://ftp.rsa.com/rsaref/
PLIST_SRC= ${WRKSRC}/.PLIST
# XXX time-dependent directory; can't give a sensible response
fetch-list:
@ -32,21 +36,20 @@ do-fetch:
cd ${_DISTDIR} && ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${RSA_SITE}`egrep '^dist/U\.S\.-only-' ${WRKDIR}/README`/${DISTNAME}${EXTRACT_SUFX} ${FETCH_AFTER_ARGS}; \
fi
pre-configure:
@${RM} -f ${WRKSRC}/md5.h
@${CP} ${FILESDIR}/Makefile ${FILESDIR}/md5.h ${WRKSRC}
@${LN} -s . ${WRKSRC}/rsaref
do-configure:
@${RM} -f ${WRKDIR}/source/md5.h
@${CP} ${FILESDIR}/md5.h ${WRKDIR}/source/
@${LN} -sf . ${WRKDIR}/source/rsaref
post-install:
do-install:
${MKDIR} ${PREFIX}/include/rsaref ${PREFIX}/share/doc/rsaref
cd ${WRKSRC} && \
${PREFIX}/bin/libtool --mode=install ${INSTALL_DATA} \
librsaref.la ${PREFIX}/lib
cd ${WRKDIR}/source && \
${INSTALL_DATA} des.h global.h md2.h md5.h rsa.h rsaref.h \
${PREFIX}/include/rsaref
@(${CAT} ${PKGDIR}/PLIST.pre; cd ${PREFIX}; \
/bin/ls 2>/dev/null -1d lib/librsaref*.a lib/librsaref.so*) \
>${PLIST_SRC}
${LDCONFIG} || ${TRUE}
${PREFIX}/include/rsaref/
cd ${WRKDIR}/doc && \
${INSTALL_DATA} info.txt rsaref.txt ${PREFIX}/share/doc/rsaref
${INSTALL_DATA} info.txt rsaref.txt ${PREFIX}/share/doc/rsaref/
.include "../../mk/bsd.pkg.mk"

View file

@ -1,13 +0,0 @@
# $NetBSD: Makefile,v 1.3 1998/05/29 19:57:27 tv Exp $
LIB= rsaref
LIBDIR= ${PREFIX}/lib
CFLAGS= -O2 -I.
SHLIB_MAJOR= 2
SHLIB_MINOR= 0
NOLINT= 1
SRCS= desc.c digit.c md2c.c nn.c prime.c rsa.c r_encode.c r_dh.c \
r_enhanc.c r_keygen.c r_random.c r_stdlib.c
.include <bsd.lib.mk>

View file

@ -1,5 +1,5 @@
--- des.h.orig Fri Mar 25 14:01:48 1994
+++ des.h Tue Feb 17 13:47:52 1998
--- ../source/des.h.orig Fri Mar 25 14:01:48 1994
+++ ../source/des.h Tue Jul 14 13:20:11 1998
@@ -4,6 +4,8 @@
#ifndef _DES_H_
#define _DES_H_ 1
@ -9,107 +9,3 @@
#ifdef __cplusplus
extern "C" {
#endif
--- global.h.orig Fri Mar 25 14:01:46 1994
+++ global.h Tue Feb 17 13:47:31 1998
@@ -7,23 +7,17 @@
#ifndef _GLOBAL_H_
#define _GLOBAL_H_ 1
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
- The following makes PROTOTYPES default to 1 if it has not already been
- defined as 0 with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 1
-#endif
+#include <sys/types.h>
+#include <sys/cdefs.h>
/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
+typedef caddr_t POINTER;
/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
+typedef u_int16_t UINT2;
/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
+typedef u_int32_t UINT4;
#ifndef NULL_PTR
#define NULL_PTR ((POINTER)0)
@@ -33,14 +27,6 @@
#define UNUSED_ARG(x) x = *(&x);
#endif
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
- If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
+#define PROTO_LIST(x) __P(x)
#endif /* end _GLOBAL_H_ */
--- md2.h.orig Fri Mar 25 14:01:49 1994
+++ md2.h Tue Feb 17 13:48:43 1998
@@ -22,6 +22,8 @@
#ifndef _MD2_H_
#define _MD2_H_ 1
+#include <rsaref/global.h>
+
#ifdef __cplusplus
extern "C" {
#endif
--- r_random.c.orig Fri Mar 25 14:01:47 1994
+++ r_random.c Tue Feb 17 13:50:33 1998
@@ -8,7 +8,7 @@
#include "global.h"
#include "rsaref.h"
#include "r_random.h"
-#include "md5.h"
+#include <rsaref/md5.h>
#define RANDOM_BYTES_NEEDED 256
--- rsa.h.orig Fri Mar 25 14:01:45 1994
+++ rsa.h Tue Feb 17 13:49:54 1998
@@ -5,6 +5,11 @@
Inc., created 1991. All rights reserved.
*/
+#ifndef _RSA_H_
+#define _RSA_H_ 1
+
+#include <rsaref/global.h>
+
int RSAPublicEncrypt PROTO_LIST
((unsigned char *, unsigned int *, unsigned char *, unsigned int,
R_RSA_PUBLIC_KEY *, R_RANDOM_STRUCT *));
@@ -17,3 +22,5 @@
int RSAPrivateDecrypt PROTO_LIST
((unsigned char *, unsigned int *, unsigned char *, unsigned int,
R_RSA_PRIVATE_KEY *));
+
+#endif
--- rsaref.h.orig Fri Mar 25 14:01:49 1994
+++ rsaref.h Tue Feb 17 13:48:26 1998
@@ -8,9 +8,9 @@
#ifndef _RSAREF_H_
#define _RSAREF_H_ 1
-#include "md2.h"
-#include "md5.h"
-#include "des.h"
+#include <rsaref/md2.h>
+#include <rsaref/md5.h>
+#include <rsaref/des.h>
#ifdef __cplusplus
extern "C" {

View file

@ -0,0 +1,47 @@
--- ../source/global.h.orig Fri Mar 25 14:01:46 1994
+++ ../source/global.h Tue Jul 14 13:20:11 1998
@@ -7,23 +7,17 @@
#ifndef _GLOBAL_H_
#define _GLOBAL_H_ 1
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
- The following makes PROTOTYPES default to 1 if it has not already been
- defined as 0 with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 1
-#endif
+#include <sys/types.h>
+#include <sys/cdefs.h>
/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
+typedef caddr_t POINTER;
/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
+typedef u_int16_t UINT2;
/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
+typedef u_int32_t UINT4;
#ifndef NULL_PTR
#define NULL_PTR ((POINTER)0)
@@ -33,14 +27,6 @@
#define UNUSED_ARG(x) x = *(&x);
#endif
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
- If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
+#define PROTO_LIST(x) __P(x)
#endif /* end _GLOBAL_H_ */

View file

@ -0,0 +1,11 @@
--- ../source/md2.h.orig Fri Mar 25 14:01:49 1994
+++ ../source/md2.h Tue Jul 14 13:20:11 1998
@@ -22,6 +22,8 @@
#ifndef _MD2_H_
#define _MD2_H_ 1
+#include <rsaref/global.h>
+
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -0,0 +1,11 @@
--- ../source/r_random.c.orig Fri Mar 25 14:01:47 1994
+++ ../source/r_random.c Tue Jul 14 13:20:11 1998
@@ -8,7 +8,7 @@
#include "global.h"
#include "rsaref.h"
#include "r_random.h"
-#include "md5.h"
+#include <rsaref/md5.h>
#define RANDOM_BYTES_NEEDED 256

View file

@ -0,0 +1,20 @@
--- ../source/rsa.h.orig Fri Mar 25 14:01:45 1994
+++ ../source/rsa.h Tue Jul 14 13:20:12 1998
@@ -5,6 +5,11 @@
Inc., created 1991. All rights reserved.
*/
+#ifndef _RSA_H_
+#define _RSA_H_ 1
+
+#include <rsaref/global.h>
+
int RSAPublicEncrypt PROTO_LIST
((unsigned char *, unsigned int *, unsigned char *, unsigned int,
R_RSA_PUBLIC_KEY *, R_RANDOM_STRUCT *));
@@ -17,3 +22,5 @@
int RSAPrivateDecrypt PROTO_LIST
((unsigned char *, unsigned int *, unsigned char *, unsigned int,
R_RSA_PRIVATE_KEY *));
+
+#endif

View file

@ -0,0 +1,15 @@
--- ../source/rsaref.h.orig Fri Mar 25 14:01:49 1994
+++ ../source/rsaref.h Tue Jul 14 13:20:12 1998
@@ -8,9 +8,9 @@
#ifndef _RSAREF_H_
#define _RSAREF_H_ 1
-#include "md2.h"
-#include "md5.h"
-#include "des.h"
+#include <rsaref/md2.h>
+#include <rsaref/md5.h>
+#include <rsaref/des.h>
#ifdef __cplusplus
extern "C" {

View file

@ -0,0 +1,48 @@
--- unix/makefile.orig Fri Mar 25 14:01:31 1994
+++ unix/makefile Tue Jul 14 13:52:28 1998
@@ -1,11 +1,11 @@
# This is a makefile for UNIX
+LIBTOOL = ${PREFIX}/bin/libtool
# extension for object files
O = o
# commands
-CC = cc
-LIB = ar
+CC = ${LIBTOOL} --mode=compile cc
# name of temporary library script
TEMPFILE = $(TEMP)/temp.mak
@@ -14,7 +14,7 @@
STDINCDIR=/usr/include
# The places to look for include files (in order).
-INCL = -I. -I$(RSAREFDIR) -I$(STDINCDIR)
+INCL = -I. -I$(RSAREFDIR)
# name of main executable to build
PROG = all
@@ -25,7 +25,7 @@
# The location of the common source directory.
RSAREFDIR = ../source/
-RSAREFLIB = rsaref.a
+RSAREFLIB = librsaref.la
# The location of the demo source directory.
RDEMODIR = ../rdemo/
@@ -38,11 +38,10 @@
dhdemo : dhdemo.$(O) $(RSAREFLIB)
cc -o $@ dhdemo.$(O) $(RSAREFLIB)
-$(RSAREFLIB) : desc.$(O) digit.$(O) md2c.$(O) md5c.$(O) nn.$(O) prime.$(O)\
+$(RSAREFLIB) : desc.$(O) digit.$(O) md2c.$(O) nn.$(O) prime.$(O)\
rsa.$(O) r_encode.$(O) r_dh.$(O) r_enhanc.$(O) r_keygen.$(O) r_random.$(O)\
r_stdlib.$(O)
- $(LIB) r $@ $?
- ranlib $@
+ ${LIBTOOL} --mode=link cc -o $@ ${?:.o=.lo} -rpath ${PREFIX}/lib -version-info 2:0
rdemo.$(O) : $(RDEMODIR)rdemo.c $(RSAREFDIR)global.h $(RSAREFDIR)rsaref.h
$(CC) $(CFLAGS) $(RDEMODIR)rdemo.c

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST.pre,v 1.1 1998/05/29 19:57:27 tv Exp $
@comment $NetBSD: PLIST,v 1.3 1998/07/14 18:48:39 tv Exp $
include/rsaref/des.h
include/rsaref/global.h
include/rsaref/md2.h
@ -6,8 +6,9 @@ include/rsaref/md5.h
include/rsaref/rsa.h
include/rsaref/rsaref.h
@dirrm include/rsaref
lib/librsaref.a
lib/librsaref.la
lib/librsaref.so.2.0
share/doc/rsaref/info.txt
share/doc/rsaref/rsaref.txt
@dirrm share/doc/rsaref
@exec /sbin/ldconfig || /usr/bin/true
@unexec /sbin/ldconfig || /usr/bin/true