From f40cdbcf1c15b088c1600caf471f4ed7ada11f27 Mon Sep 17 00:00:00 2001 From: pho Date: Sat, 27 Jun 2009 14:03:09 +0900 Subject: [PATCH] Fixed some minor problems in the previous patch. Ignore-this: 6beae1b20cc4c22b2c6eec092b735853 darcs-hash:20090627050309-62b54-1fdd14b386f8a1509c7615962296b605798e170e.gz --- AUTHORS | 2 + GNUmakefile | 5 ++ HsOpenSSL.cabal | 30 ++++---- Makefile | 37 ---------- NEWS | 16 +++++ cabal-package.mk | 89 ++++++++++++++++++++++++ cbits/{mutex-linux.c => mutex-pthread.c} | 0 cbits/mutex.h | 7 +- 8 files changed, 126 insertions(+), 60 deletions(-) create mode 100644 GNUmakefile delete mode 100644 Makefile create mode 100644 cabal-package.mk rename cbits/{mutex-linux.c => mutex-pthread.c} (100%) diff --git a/AUTHORS b/AUTHORS index 6f5fa28..7c6b7e8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,7 @@ This is a list of contributors to the HsOpenSSL. * Adam Langley +* John Van Enk and his friend * Taru Karttunen * PHO + diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..b0d559a --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,5 @@ +RUN_COMMAND = $(MAKE) -C examples run + +CONFIGURE_ARGS = --disable-optimization --extra-include-dirs=/usr/pkg/include --extra-lib-dirs=/usr/pkg/lib + +include cabal-package.mk diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal index 8934c2d..4cfa23c 100644 --- a/HsOpenSSL.cabal +++ b/HsOpenSSL.cabal @@ -5,7 +5,7 @@ Description: can generate RSA and DSA keys, read and write PEM files, generate message digests, sign and verify messages, encrypt and decrypt messages. -Version: 0.6.1 +Version: 0.6.2 License: PublicDomain License-File: COPYING Author: Adam Langley , PHO @@ -18,12 +18,9 @@ Cabal-Version: >= 1.6 Build-Type: Simple Extra-Source-Files: AUTHORS - HsOpenSSL.buildinfo.in NEWS cbits/HsOpenSSL.h cbits/mutex.h - configure - configure.ac examples/Makefile examples/GenRSAKey.hs examples/HelloWorld.hs @@ -38,22 +35,19 @@ Source-Repository head Location: http://darcs.cielonegro.org/HsOpenSSL/ Library - Build-Depends: base >= 4, bytestring, ghc-prim, integer, time >= 1.1.1, old-locale, network>=2.1.0.0 - --PkgConfig-Depends: openssl >= 0.9.7l - -- We really should use this instead of the configure script but - -- Cabal 1.6.0.1 can't handle this weird version scheme of OpenSSL. + Build-Depends: base >= 4 && < 5, bytestring, ghc-prim, integer, time >= 1.1.1, old-locale, network>=2.1.0.0 + if os(mingw32) Extra-Libraries: eay32 - c-sources: cbits/mutex-win.c - cc-options: -D MINGW32 - cpp-options: -DCALLCONV=stdcall - - if os(linux) - Extra-Libraries: ssl - build-depends: unix >= 2.3.0.0 - c-sources: cbits/mutex-linux.c - cc-options: -D LINUX - cpp-options: -DCALLCONV=ccall + C-Sources: cbits/mutex-win.c + CC-Options: -D MINGW32 + CPP-Options: -DCALLCONV=stdcall + else + Extra-Libraries: crypto ssl + build-depends: unix >= 2.3.0.0 + C-Sources: cbits/mutex-pthread.c + CC-Options: -D PTHREAD + CPP-Options: -DCALLCONV=ccall Exposed-Modules: OpenSSL diff --git a/Makefile b/Makefile deleted file mode 100644 index 5ff0841..0000000 --- a/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -CABAL_FILE = HsOpenSSL.cabal -GHC = ghc - -build: dist/setup-config Setup - ./Setup build - -run: build - @echo ".:.:. Let's go .:.:." - $(MAKE) -C examples run - -dist/setup-config: $(CABAL_FILE) configure Setup - ./Setup configure -O - -configure: aclocal.m4 configure.ac - autoconf - -aclocal.m4: - aclocal - -Setup: Setup.hs - $(GHC) --make Setup - -clean: - rm -rf dist Setup Setup.o Setup.hi .setup-config *.buildinfo - find . -name '*~' -exec rm -f {} \; - $(MAKE) -C examples clean - -doc: dist/setup-config Setup - ./Setup haddock - -install: build - sudo ./Setup install - -sdist: Setup - ./Setup sdist - -.PHONY: build run clean install doc sdist diff --git a/NEWS b/NEWS index 185c0b3..71686a6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,20 @@ -*- Coding: utf-8 -*- +Chanegs from 0.6.1 to 0.6.2 +--------------------------- +* Applied a patch by John Van Enk and his friend: + + 1) Moved away from the Configure build type to the Simple build + type. + + 2) Removed the direct dependency on pthreads. This involved an + indirection layer using the preprocessor. In linux/bsd, we use + pthreads. In windows, we call out to the OS mutexing + functions. This allows us to "cabal install" the HsOpenSSL + library from the cmd.exe terminal in windows *without* having to + use cygwin. + + Changes from 0.6 to 0.6.1 ------------------------- * OpenSSL.Session: @@ -10,6 +25,7 @@ Changes from 0.6 to 0.6.1 # contextSetPrivateKey # contextSetCertificate + Changes from 0.5.2 to 0.6 ------------------------- * INCOMPATIBLE CHANGES: diff --git a/cabal-package.mk b/cabal-package.mk new file mode 100644 index 0000000..ca291ff --- /dev/null +++ b/cabal-package.mk @@ -0,0 +1,89 @@ +# -*- makefile-gmake -*- +# +# Variables: +# +# CONFIGURE_ARGS :: arguments to be passed to ./Setup configure +# default: --disable-optimization +# +# RUN_COMMAND :: command to be run for "make run" +# + +GHC ?= ghc +FIND ?= find +RM_RF ?= rm -rf +SUDO ?= sudo +AUTOCONF ?= autoconf + +CONFIGURE_ARGS ?= --disable-optimization + +SETUP_FILE := $(wildcard Setup.*hs) +CABAL_FILE := $(wildcard *.cabal) + +ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac) + AUTOCONF_AC_FILE := configure.ac + AUTOCONF_FILE := configure +else + ifeq ($(shell ls configure.in 2>/dev/null),configure.in) + AUTOCONF_AC_FILE := configure.in + AUTOCONF_FILE := configure + else + AUTOCONF_AC_FILE := + AUTOCONF_FILE := + endif +endif + +BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in) +BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=) + +all: build + +build: setup-config build-hook + ./Setup build + +build-hook: + +ifeq ($(RUN_COMMAND),) +run: + @echo "cabal-package.mk: No command to run." + @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable." +else +run: build + @echo ".:.:. Let's go .:.:." + $(RUN_COMMAND) +endif + +setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE) + +setup-config-hook: + +dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE) + ./Setup configure $(CONFIGURE_ARGS) + +$(AUTOCONF_FILE): $(AUTOCONF_AC_FILE) + $(AUTOCONF) + +$(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure + ./Setup configure $(CONFIGURE_ARGS) + +Setup: $(SETUP_FILE) + $(GHC) --make Setup + +clean: clean-hook + $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo + $(FIND) . -name '*~' -exec rm -f {} \; + +clean-hook: + +doc: setup-config + ./Setup haddock + +install: build + $(SUDO) ./Setup install + +sdist: setup-config + ./Setup sdist + +test: build + ./Setup test + +.PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test diff --git a/cbits/mutex-linux.c b/cbits/mutex-pthread.c similarity index 100% rename from cbits/mutex-linux.c rename to cbits/mutex-pthread.c diff --git a/cbits/mutex.h b/cbits/mutex.h index a1f0123..69bec8c 100644 --- a/cbits/mutex.h +++ b/cbits/mutex.h @@ -4,14 +4,11 @@ #if defined(MINGW32) #include typedef HANDLE mutex_t; -#elif defined(LINUX) - #include - typedef pthread_mutex_t mutex_t; -#elif defined(BSD) +#elif defined(PTHREAD) #include typedef pthread_mutex_t mutex_t; #else - #error "ERROR: This platform not supported." + #error "ERROR: This platform is not supported." #endif void mutex_init(mutex_t* mutex);