From 20cf2e749b2f03b8fa28133ee0365f5ecb72d9e8 Mon Sep 17 00:00:00 2001 From: PHO Date: Sun, 8 Aug 2010 15:44:47 +0900 Subject: [PATCH] Initial revision --- .gitignore | 5 ++ Bindings/APR.hsc | 180 +++++++++++++++++++++++++++++++++++++++++++++ COPYING | 29 ++++++++ GNUmakefile | 5 ++ Setup.hs | 4 + bindings-apr.cabal | 34 +++++++++ cabal-package.mk | 95 ++++++++++++++++++++++++ 7 files changed, 352 insertions(+) create mode 100644 .gitignore create mode 100644 Bindings/APR.hsc create mode 100644 COPYING create mode 100644 GNUmakefile create mode 100644 Setup.hs create mode 100644 bindings-apr.cabal create mode 100644 cabal-package.mk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f76a6e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.hi +*.o + +Setup +dist diff --git a/Bindings/APR.hsc b/Bindings/APR.hsc new file mode 100644 index 0000000..4913ba2 --- /dev/null +++ b/Bindings/APR.hsc @@ -0,0 +1,180 @@ +#include +#include + +module Bindings.APR where +#strict_import + +{- I'm not sure if these are really useful... (PHO) + -} +#num APR_HAS_INLINE + +#num APR_HAVE_ARPA_INET_H +#num APR_HAVE_CONIO_H +#num APR_HAVE_CRYPT_H +#num APR_HAVE_CTYPE_H +#num APR_HAVE_DIRENT_H +#num APR_HAVE_ERRNO_H +#num APR_HAVE_FCNTL_H +#num APR_HAVE_IO_H +#num APR_HAVE_LIMITS_H +#num APR_HAVE_NETDB_H +#num APR_HAVE_NETINET_IN_H +#num APR_HAVE_NETINET_SCTP_H +#num APR_HAVE_NETINET_SCTP_UIO_H +#num APR_HAVE_NETINET_TCP_H +#num APR_HAVE_PTHREAD_H +#num APR_HAVE_SEMAPHORE_H +#num APR_HAVE_SIGNAL_H +#num APR_HAVE_STDARG_H +#num APR_HAVE_STDINT_H +#num APR_HAVE_STDIO_H +#num APR_HAVE_STDLIB_H +#num APR_HAVE_STRING_H +#num APR_HAVE_STRINGS_H +#num APR_HAVE_SYS_IOCTL_H +#num APR_HAVE_SYS_SENDFILE_H +#num APR_HAVE_SYS_SIGNAL_H +#num APR_HAVE_SYS_SOCKET_H +#num APR_HAVE_SYS_SOCKIO_H +#num APR_HAVE_SYS_SYSLIMITS_H +#num APR_HAVE_SYS_TIME_H +#num APR_HAVE_SYS_TYPES_H +#num APR_HAVE_SYS_UIO_H +#num APR_HAVE_SYS_UN_H +#num APR_HAVE_SYS_WAIT_H +#num APR_HAVE_TIME_H +#num APR_HAVE_UNISTD_H +#num APR_HAVE_WINDOWS_H +#num APR_HAVE_WINSOCK2_H + +#num APR_HAVE_SHMEM_MMAP_TMP +#num APR_HAVE_SHMEM_MMAP_SHM +#num APR_HAVE_SHMEM_MMAP_ZERO +#num APR_HAVE_SHMEM_SHMGET_ANON +#num APR_HAVE_SHMEM_SHMGET +#num APR_HAVE_SHMEM_MMAP_ANON +#num APR_HAVE_SHMEM_BEOS + +#num APR_USE_SHMEM_MMAP_TMP +#num APR_USE_SHMEM_MMAP_SHM +#num APR_USE_SHMEM_MMAP_ZERO +#num APR_USE_SHMEM_SHMGET_ANON +#num APR_USE_SHMEM_SHMGET +#num APR_USE_SHMEM_MMAP_ANON +#num APR_USE_SHMEM_BEOS + +#num APR_USE_FLOCK_SERIALIZE +#num APR_USE_SYSVSEM_SERIALIZE +#num APR_USE_POSIXSEM_SERIALIZE +#num APR_USE_FCNTL_SERIALIZE +#num APR_USE_PROC_PTHREAD_SERIALIZE +#num APR_USE_PTHREAD_SERIALIZE + +#num APR_HAS_FLOCK_SERIALIZE +#num APR_HAS_SYSVSEM_SERIALIZE +#num APR_HAS_POSIXSEM_SERIALIZE +#num APR_HAS_FCNTL_SERIALIZE +#num APR_HAS_PROC_PTHREAD_SERIALIZE + +#num APR_PROCESS_LOCK_IS_GLOBAL + +#num APR_HAVE_CORKABLE_TCP +#num APR_HAVE_GETRLIMIT +#num APR_HAVE_IN_ADDR +#num APR_HAVE_INET_ADDR +#num APR_HAVE_INET_NETWORK +#num APR_HAVE_IPV6 +#num APR_HAVE_MEMMOVE +#num APR_HAVE_SETRLIMIT +#num APR_HAVE_SIGACTION +#num APR_HAVE_SIGSUSPEND +#num APR_HAVE_SIGWAIT +#num APR_HAVE_SA_STORAGE +#num APR_HAVE_STRCASECMP +#num APR_HAVE_STRDUP +#num APR_HAVE_STRICMP +#num APR_HAVE_STRNCASECMP +#num APR_HAVE_STRNICMP +#num APR_HAVE_STRSTR +#num APR_HAVE_MEMCHR +#num APR_HAVE_STRUCT_RLIMIT +#num APR_HAVE_UNION_SEMUN +#num APR_HAVE_SCTP +#num APR_HAVE_IOVEC + +#num APR_HAS_SHARED_MEMORY +#num APR_HAS_THREADS +#num APR_HAS_SENDFILE +#num APR_HAS_MMAP +#num APR_HAS_FORK +#num APR_HAS_RANDOM +#num APR_HAS_OTHER_CHILD +#num APR_HAS_DSO +#num APR_HAS_SO_ACCEPTFILTER +#num APR_HAS_UNICODE_FS +#num APR_HAS_PROC_INVOKED +#num APR_HAS_USER +#num APR_HAS_LARGE_FILES +#num APR_HAS_XTHREAD_FILES +#num APR_HAS_OS_UUID + +#num APR_PROCATTR_USER_SET_REQUIRES_PASSWORD + +#if APR_HAVE_NETINET_TCP_H +#include +#endif + +#num APR_FILES_AS_SOCKETS +#num APR_CHARSET_EBCDIC +#num APR_TCP_NOPUSH_FLAG +#num APR_TCP_NODELAY_INHERITED +#num APR_O_NONBLOCK_INHERITED + +#integral_t apr_byte_t + +#integral_t apr_int16_t +#integral_t apr_uint16_t + +#integral_t apr_int32_t +#integral_t apr_uint32_t + +#integral_t apr_int64_t +#integral_t apr_uint64_t + +#integral_t apr_size_t +#integral_t apr_ssize_t +#integral_t apr_off_t +#integral_t apr_socklen_t +#integral_t apr_ino_t + +#num APR_SIZEOF_VOIDP +#integral_t apr_uintptr_t + +#num APR_IS_BIGENDIAN + +#num APR_INT16_MIN +#num APR_INT16_MAX +#num APR_UINT16_MAX +#num APR_INT32_MIN +#num APR_INT32_MAX +#num APR_UINT32_MAX +#num APR_INT64_MIN +#num APR_INT64_MAX +#num APR_UINT64_MAX +#num APR_SIZE_MAX + +#pointer APR_SSIZE_T_FMT +#pointer APR_SIZE_T_FMT +#pointer APR_OFF_T_FMT +#pointer APR_PID_T_FMT +#pointer APR_INT64_T_FMT +#pointer APR_UINT64_T_FMT +#pointer APR_UINT64_T_HEX_FMT +#num APR_PROC_MUTEX_IS_GLOBAL +#pointer APR_EOL_STR + +#opaque_t apr_wait_t + +#num APR_PATH_MAX + +#pointer APR_DSOPATH diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..24b9580 --- /dev/null +++ b/COPYING @@ -0,0 +1,29 @@ + + + + + bindings-apr + + + PHO + + + + + + + + + + + + diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..15098cd --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,5 @@ +#RUN_COMMAND = $(MAKE) -C examples run + +CONFIGURE_ARGS = -O + +include cabal-package.mk diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..bd92fff --- /dev/null +++ b/Setup.hs @@ -0,0 +1,4 @@ +#!/usr/bin/env runghc + +import Distribution.Simple +main = defaultMain diff --git a/bindings-apr.cabal b/bindings-apr.cabal new file mode 100644 index 0000000..55ef003 --- /dev/null +++ b/bindings-apr.cabal @@ -0,0 +1,34 @@ +Name: bindings-apr +Synopsis: Low level bindings to Apache Portable Runtime (APR) +Description: + Bindings to APR: http://apr.apache.org/ +Version: 0.1 +License: PublicDomain +License-File: COPYING +Author: PHO +Maintainer: PHO +Stability: experimental +Homepage: http://cielonegro.org/Bindings-APR.html +Category: FFI +Tested-With: GHC == 6.12.3 +Cabal-Version: >= 1.6 +Build-Type: Simple +Extra-Source-Files: + +Source-Repository head + Type: git + Location: git://git.cielonegro.org/bindings-apr.git + +Library + Build-Depends: + base == 4.2.*, + bindings-DSL == 1.0.* + + PkgConfig-Depends: + apr-1 >= 1.3 + + Exposed-Modules: + Bindings.APR + + Extensions: + ForeignFunctionInterface diff --git a/cabal-package.mk b/cabal-package.mk new file mode 100644 index 0000000..d8bbaad --- /dev/null +++ b/cabal-package.mk @@ -0,0 +1,95 @@ +# -*- 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 +HLINT ?= hlint + +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 + +lint: + $(HLINT) . --report \ + --ignore="Use string literal" \ + --ignore="Use concatMap" + +.PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint -- 2.40.0