Have hs-crypto register itself via the GHC package mechanism on

pkg_add, and unregister itself on pkg_delete. Means the user has a
more friendly Haskell library system.

ok pvalchev@
This commit is contained in:
dons 2004-05-07 01:37:50 +00:00
parent eacc7e4aed
commit 0cdbffcd36
4 changed files with 17 additions and 14 deletions

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
$OpenBSD: patch-Makefile,v 1.2 2004/05/07 01:37:50 dons Exp $
* Install into a decent place
* Make it easier to install docs
* Generate a working package descr
* Generate a working package description for use by ghc-pkg at pkg_add time
--- Makefile.orig 2003-12-23 04:31:57.000000000 +1100
+++ Makefile 2004-05-02 15:48:09.000000000 +1000
+++ Makefile 2004-05-06 18:33:37.000000000 +1000
@@ -3,7 +3,7 @@ AR = ar
LD = ld
INSTALL = install
@ -15,7 +15,7 @@ $OpenBSD: patch-Makefile,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
PREFIXE = Codec/Encryption
PREFIXA = Codec/ASN1
@@ -40,15 +40,24 @@ package: $(OBJSE) $(OBJSA)
@@ -40,15 +40,22 @@ package: $(OBJSE) $(OBJSA)
rm -f libHScrypto.a
$(AR) -q libHScrypto.a $^
$(LD) -r -o HScrypto.o $^
@ -24,12 +24,10 @@ $OpenBSD: patch-Makefile,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
- $(INSTALL) libHScrypto.a $(LIBRARY)/libHScrypto.a
- $(INSTALL) HScrypto.o $(LIBRARY)/HScrypto.o
- $(INSTALL) -d $(LIBRARY)/imports/HScrypto
+ echo [] > package.conf
+ echo [] > package.conf.inplace
+ cpp < package.conf.in | sed 's/^#.*$$//g' > package.conf.install.in
+ cpp -DINPLACE < package.conf.in | sed 's/^#.*$$//g' > package.conf.inplace.in
+ ghc-pkg --force -f package.conf -u < package.conf.install.in
+ ghc-pkg --force -f package.conf.inplace -u < package.conf.inplace.in
+ cpp < package.conf.in | sed 's/^#.*$$//g' > package.conf.install.in
+
+install: doc libHScrypto.a HScrypto.o
+ $(INSTALL) -d $(LIBRARY)/hs-crypto
@ -42,12 +40,12 @@ $OpenBSD: patch-Makefile,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
+ $(INSTALL) -d $(LIBRARY)/hs-crypto/imports/HScrypto/`dirname $$i`; \
+ $(INSTALL) -c $$i $(LIBRARY)/hs-crypto/imports/HScrypto/`dirname $$i`; \
done
+ $(INSTALL) package.conf $(LIBRARY)/hs-crypto/package.conf
+ $(INSTALL) package.conf.install.in $(LIBRARY)/hs-crypto/package.conf.in
+ cp -R hs-crypto $(PREFIX)/share/doc/
Test: $(OBJSE) Test.o
$(HC) -o $@ $(HC_OPTS) $(OBJSE) Test.o
@@ -63,7 +72,8 @@ RSATest: $(OBJSE) RSATest.o
@@ -63,7 +70,8 @@ RSATest: $(OBJSE) RSATest.o
$(HC) -c $< $(HC_OPTS) -package-name crypto
doc:

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-package_conf_in,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
$OpenBSD: patch-package_conf_in,v 1.2 2004/05/07 01:37:50 dons Exp $
let hs-crypto work with the ghc package system, and with the regress
suite
@ -9,7 +9,7 @@ suite
+Package
+ {name = "crypto",
+#ifndef INPLACE
+ import_dirs = ["${PREFIX}/lib/hs-crypto/imports"],
+ import_dirs = ["${PREFIX}/lib/hs-crypto/imports/HScrypto"],
+#else
+ import_dirs = ["${WRKDIST}"],
+#endif

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------
To link against the library, add:
-package-conf /usr/local/lib/hs-crypto/package.conf -package crypto
-package crypto
to the GHC command line
------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2004/05/03 07:36:32 dons Exp $
@comment $OpenBSD: PLIST,v 1.2 2004/05/07 01:37:50 dons Exp $
lib/hs-crypto/HScrypto.o
lib/hs-crypto/imports/HScrypto/Codec/ASN1/ASN1.hi
lib/hs-crypto/imports/HScrypto/Codec/Encryption/Blowfish.hi
@ -16,7 +16,7 @@ lib/hs-crypto/imports/HScrypto/Codec/Encryption/SHA1.hi
lib/hs-crypto/imports/HScrypto/Codec/Encryption/SHA1Aux.hi
lib/hs-crypto/imports/HScrypto/Codec/Encryption/Utils.hi
lib/hs-crypto/libHScrypto.a
lib/hs-crypto/package.conf
lib/hs-crypto/package.conf.in
share/doc/hs-crypto/Codec.ASN1.ASN1.html
share/doc/hs-crypto/Codec.Encryption.Blowfish.html
share/doc/hs-crypto/Codec.Encryption.BlowfishAux.html
@ -62,3 +62,8 @@ share/doc/hs-crypto/index.html
@dirrm lib/hs-crypto/imports/HScrypto
@dirrm lib/hs-crypto/imports
@dirrm lib/hs-crypto
@comment call ghc-pkg to register/unregister this library with ghc
@exec /bin/cat %D/lib/hs-crypto/package.conf.in | /usr/bin/env PREFIX=%D %D/bin/ghc-pkg -u
@exec /bin/rm -f %D/lib/ghc-6.2.1/package.conf.old
@unexec %D/bin/ghc-pkg -r crypto
@unexec /bin/rm -f %D/lib/ghc-6.2.1/package.conf.old