Commit 481c4214 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Reorganise and prune tests/

Split them into unit tests and system tests. Also remove the rather large
bundled HSQL and HUnit packages. We can just depend on HUnit for the tests
rather than bundling it. HSQL is very large for a system test and we can
just as easily get it and others from hackage.
parent a064c28e
name: hsql
license: BSD3
version: 1.4
copyright: filler for test suite
maintainer: filler for test suite
synopsis: interface to databases
description: a simple library, which provides an interface to multiple databases. MySQL, PostgreSQL, ODBC and SQLite (new) are currently supported.
Copyright (c) 2003, Krasimir Angelov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* 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.
* Neither the name of the HToolkit nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
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.
include config.mk
COMPILERS =
ifneq "$(GHC)" ""
COMPILERS += ghc
endif
# ifneq "$(HUGS)" ""
# COMPILERS += hugs
# endif
#--------------------------------------------------------------------------
# DIRECTORIES
#--------------------------------------------------------------------------
# library and doc output
BUILDDIR = build
DOCDIR = doc
HOUTDIR = $(BUILDDIR)/Database
HSQLLib = $(BUILDDIR)/libHSsql.a
# source dirs
VPATH = src
#--------------------------------------------------------------------------
# SOURCES
#--------------------------------------------------------------------------
HSC_SRC += HSQL.hsc
ifeq "$(WithODBC)" "YES"
HSC_SRC += HSQL/ODBC.hsc
endif
ifeq "$(WithPostgreSQL)" "YES"
HSC_SRC += HSQL/PostgreSQL.hsc
endif
ifeq "$(WithMySQL)" "YES"
HSC_SRC += HSQL/MySQL.hsc
endif
ifeq "$(WithSQLite)" "YES"
HSC_SRC += HSQL/SQLite.hsc
endif
SO_SRC = $(patsubst %.hsc,$(HOUTDIR)/%.$(SO_EXT),$(HSC_SRC))
HS_SRC = $(HOUTDIR)/HSQL/Types.hs $(patsubst %.hsc,$(HOUTDIR)/%.hs,$(HSC_SRC))
HI_SRC = $(patsubst %.hs,%.hi,$(HS_SRC))
OBJS = $(patsubst %.hs,%.o, $(HS_SRC))
HS_DEPS = $(patsubst %.hs,%.d, $(HS_SRC))
ifeq "$(WithODBC)" "YES"
ifeq "$(WIN32)" "YES"
HsODBC_o = $(HOUTDIR)/HSQL/HsODBC.o
endif
endif
#--------------------------------------------------------------------------
# FLAGS
#--------------------------------------------------------------------------
FFIHUGS_FLAGS = $(patsubst %, +L"%", $(CPPFLAGS))
ifeq "$(WIN32)" "YES"
ODBC_FFIHUGS_FLAGS = +L"$(HsODBC_o)"
FFIHUGS_FLAGS += $(patsubst %, +L"%", $(patsubst -l%, %.lib, $(LDFLAGS)))
else
FFIHUGS_FLAGS += $(patsubst %, +L"%", $(LDFLAGS))
endif
ifeq "$(HADDOCK)" ""
HADDOCK = echo
else
HS_PPS = $(addsuffix .raw-hs, $(basename $(HS_SRC)))
endif
#--------------------------------------------------------------------------
# RULES
#--------------------------------------------------------------------------
.SUFFIXES: .hs .hi .o .c
# should be:
#
# $(HSC2HS) $< -o $@ $(CPPFLAGS)
#
# but there is a bug in hsc2hs from GHC 6.2 for Windows
$(HOUTDIR)/%.hs: %.hsc
$(HSC2HS) $< $(CPPFLAGS)
mv $(patsubst %.hsc, %.hs, $<) $@
%.o : %.hs
mkdir -p $(basename $<)_split
rm -f $(basename $<)_split/*
$(GHC) $< -O -c -i$(BUILDDIR) -fglasgow-exts -split-objs $(CPPFLAGS) -package-name hsql
$(LD) -r -o $@ $(basename $<)_split/*.o
@# create dependency file
@$(GHC) $< -M -i$(BUILDDIR) -optdep-f -optdep$(*F).d $(CPPFLAGS)
@sed -e 's|$(subst .hs,,$<)\.o|$*\.o|' $(*F).d > $*.d
@rm $(*F).d
.o.hi:
@:
%.$(SO_EXT): %.hs
$(FFIHUGS) -98 +G -P$(BUILDDIR): $(FFIHUGS_FLAGS) $($(*F)_FFIHUGS_FLAGS) $<
%.raw-hs : %.hs
$(GHC) -Iincludes $(CPPFLAGS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
all: $(patsubst %, all-%, $(COMPILERS))
all-ghc: $(HSQLLib)
all-hugs: $(SO_SRC)
$(HSQLLib): $(OBJS) $(HsODBC_o)
rm -f $(HSQLLib)
for i in $(patsubst %.o,%_split, $(OBJS)); do \
$(AR) -q $(HSQLLib) $$i/*.o; \
done
$(AR) -q $(HSQLLib) $(HsODBC_o)
genclean: distclean
rm -rf configure autom4te.cache
distclean: clean
rm -f $(HSQLLib)
rm -f config.status config.log config.mk hsql.pkg
clean:
rm -f $(OBJS)
rm -f $(HI_SRC)
rm -f $(SO_SRC)
rm -f $(HS_SRC)
rm -f $(patsubst %.hs,%.c,$(HS_SRC))
rm -f $(HS_PPS)
rm -f $(HS_DEPS)
rm -rf $(patsubst %.o,%_split, $(OBJS))
rm -f $(HSQLLib)
docs : $(HS_PPS)
mkdir -p $(DOCDIR)
$(HADDOCK) -h -o $(DOCDIR) $(HS_PPS)
install: $(patsubst %, install-%, $(COMPILERS))
install-ghc: $(HSQLLib) $(HI_SRC) docs
$(INSTALL) -d $(GHC_DIR)
$(INSTALL) $(HSQLLib) $(GHC_DIR)/libHSsql.a
for i in $(patsubst $(BUILDDIR)/%,%,$(HI_SRC)); do \
$(INSTALL) -d $(GHC_DIR)/imports/`dirname $$i`; \
$(INSTALL) -c $(BUILDDIR)/$$i $(GHC_DIR)/imports/`dirname $$i`; \
done
rm -f $(GHC_DIR)/HSsql.o
$(GHC_PKG) --config-file=tmpConfig -u -g -i hsql.pkg
if test -f $(DOCDIR)/index.html; then \
$(INSTALL) -d $(DOC_DIR); \
$(INSTALL) -c $(DOCDIR)/* $(DOC_DIR); \
fi
install-hugs: $(HS_SRC) $(SO_SRC)
$(INSTALL) -d $(HUGS_DIR)/libraries/Database
for i in $(patsubst $(BUILDDIR)/%,%,$(HS_SRC) $(SO_SRC)); do \
$(INSTALL) -d $(HUGS_DIR)/libraries/`dirname $$i`; \
$(INSTALL) -c $(BUILDDIR)/$$i $(HUGS_DIR)/libraries/`dirname $$i`; \
done
setup: Setup.lhs
ghc -cpp --make -i../.. Setup.lhs -o setup 2>out.build
-include $(HS_DEPS)
$(HOUTDIR)/HSQL/ODBC.hs : HSQL/HsODBC.h
$(HOUTDIR)/HSQL/Types.hs : HSQL/Types.hs
cp $< $@
$(HOUTDIR)/HSQL/HsODBC.o : HSQL/HsODBC.c HSQL/HsODBC.h
$(CC) $< -o $@ -O -c $(CPPFLAGS)
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "HSQL"
!define PRODUCT_VERSION "1.4"
!define PRODUCT_PUBLISHER "Krasimir Angelov"
!define PRODUCT_WEB_SITE "http://htoolkit.sourceforge.net"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define REQUIRED_GHC_VERSION "6.2.1"
; Path to the HSQL build directory:
!define HSQL_PATH ".."
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "${HSQL_PATH}\LICENSE"
; Settings
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
;Startmenu
Var STARTMENU_FOLDER
!insertmacro MUI_PAGE_STARTMENU PRODUCT_NAME $STARTMENU_FOLDER
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
!include "StrFunc.nsh"
${StrRep}
Var GHCDIR
Var DOCS
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
InstallDir "c:\HToolkit\HSQL"
ShowInstDetails show
ShowUnInstDetails show
Section "HSQL for GHC-${REQUIRED_GHC_VERSION}" SEC01
ReadRegStr $GHCDIR HKLM "SOFTWARE\Haskell\GHC\ghc-${REQUIRED_GHC_VERSION}" "InstallDir"
StrCmp $GHCDIR "" GetDir Ok
IfErrors +1 Ok
GetDir:
MessageBox MB_ICONEXCLAMATION "Couldn't find GHC"
StrCpy $GHCDIR $R9
StrCmp $GHCDIR "" Cancel Ok
Cancel:
Abort "Couldn't find GHC"
Ok:
SetOverwrite ifnewer
SetOutPath "$INSTDIR\GHC"
File /r "${HSQL_PATH}\hsql.pkg.in"
File /r "${HSQL_PATH}\build\libHSsql.a"
File /r "${HSQL_PATH}\mingw32lib\liblibmysql.a"
File /r "${HSQL_PATH}\mingw32lib\liblibpq.a"
File /r "${HSQL_PATH}\mingw32lib\libsqlite.a"
SetOutPath "$INSTDIR\GHC\imports"
File /r "${HSQL_PATH}\build\*.hi"
; Fix the hsql.pkg-file
Call fixPkg
StrCpy $R0 "$GHCDIR\bin\ghc-pkg -u -g -i $\"$INSTDIR\GHC\hsql.pkg$\""
ExecWait $R0
SectionEnd
Section "HSQL for Hugs" SEC02
SetOutPath "$INSTDIR\Hugs\libraries"
File /r "${HSQL_PATH}\build\*.hs"
File /r "${HSQL_PATH}\build\*.dll"
SectionEnd
Section "Documentation" SEC03
StrCpy $DOCS "yes"
SetOverwrite ifnewer
SetOutPath "$INSTDIR\doc"
File /r "${HSQL_PATH}\doc\*.html"
File /r "${HSQL_PATH}\doc\*.gif"
File /r "${HSQL_PATH}\doc\*.css"
SectionEnd
Section "Examples" SEC04
SetOverwrite ifnewer
SetOutPath "$INSTDIR\examples"
File /r "${HSQL_PATH}\examples\*.hs"
SectionEnd
Section -DLL
SetOverwrite ifnewer
SetOutPath "$SYSDIR"
File /r "${HSQL_PATH}\mingw32lib\*.dll"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
StrCmp $DOCS "yes" +1 +2
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Documentation.lnk" "$INSTDIR\doc\index.html"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu" "$STARTMENU_FOLDER"
SectionEnd
; Component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_Section2)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_Section3)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_Section4)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
LangString DESC_Section1 ${LANG_ENGLISH} "Install HSQL for GHC"
LangString DESC_Section2 ${LANG_ENGLISH} "Install HSQL for Hugs"
LangString DESC_Section3 ${LANG_ENGLISH} "Install HSQL with documentation"
LangString DESC_Section4 ${LANG_ENGLISH} "Install HSQL examples"
Function fixPkg
; Fix the hsql.pkg file to the right paths
; in order to be able to add the hsql package to ghc.
clearErrors
FileOpen $0 "$INSTDIR\GHC\hsql.pkg.in" "r"
GetTempFileName $R0
FileOpen $1 $R0 "w"
loop:
FileRead $0 $2
IfErrors done
${StrRep} $R1 $2 "@GHC_DIR@" "$INSTDIR/GHC"
${StrRep} $R1 $R1 "@LIB_DIRS@" "$\"$INSTDIR/GHC$\""
${StrRep} $R1 $R1 "@DEP_LIBS@" "$\"sqlite$\", $\"libpq$\", $\"odbc32$\", $\"libmysql$\""
${StrRep} $R1 $R1 "\" "/"
FileWrite $1 $R1
Goto loop
done:
FileClose $0
FileClose $1
CopyFiles /SILENT $R0 "$INSTDIR\GHC\hsql.pkg"
Delete $R0
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
; Remove HSQL from statmenu
ReadRegStr $STARTMENU_FOLDER ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu"
ifErrors +2 +1
RMDir /r "$SMPROGRAMS\$STARTMENU_FOLDER"
RMDir /r "$INSTDIR"
; Remove hsql package from ghc
ReadRegStr $GHCDIR HKLM "SOFTWARE\Haskell\GHC\ghc-${REQUIRED_GHC_VERSION}" "InstallDir"
ifErrors +1 +3
MessageBox MB_ICONEXCLAMATION "Unable to remove hsql lib files from the ghc folder"
goto end
StrCpy $R0 "$\"$GHCDIR\bin\ghc-pkg$\" -r hsql"
ExecWait $R0
end:
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd
Summary: Haskell database interaction library
Name: HSQL
Version: 1.4
Release: 1
Copyright: BSD
vendor: HToolkit Team
packager: Conny Andersson <forester@dtek.chalmers.se>
Group: Development/Libraries
Source: HSQL.tar.gz
Requires: ghc >= 6.2.1
Requires: hugs98 = Nov2003
Requires: sqlite >= 2.8.12
Requires: postgresql-libs >= 7.4.1
Requires: unixODBC >= 2.2.5
Requires: MySQL-shared >= 4.1.1
%description
HSQL allows haskell programmers to interact with databases using MySQL, PostgreSQL, ODBC and SQLite.
%prep
%setup -n HSQL
%post
ghc-pkg -u --auto-ghci-libs <<- \EOF
Package
{name = "hsql",
auto=True,
import_dirs = ["/usr/lib/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["/usr/lib/ghc-6.2","/usr/lib","/usr/lib/mysql"],
hs_libraries = ["HSsql"],
extra_libraries = ["sqlite","pq","odbc","mysqlclient","z","crypt","nsl","m","c","nss_files","nss_dns","resolv","c","nss_files","nss_dns","resolv","sqlite"],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []
}
EOF
%postun
ghc-pkg -r hsql
%build
./configure --enable-mysql --enable-postgres --enable-odbc --enable-sqlite
make
make docs
%install
make install
%files
%defattr (-,root,root)
#GHC
/usr/lib/ghc-6.2/libHSsql.a
/usr/lib/ghc-6.2/imports/Database/HSQL
/usr/lib/ghc-6.2/imports/Database/HSQL.hi
#Hugs
/usr/lib/hugs/libraries/Database/HSQL
/usr/lib/hugs/libraries/Database/HSQL.hs
/usr/lib/hugs/libraries/Database/HSQL.so
#GHC-Docs
/usr/lib/ghc-6.2/doc/html/libraries/hsql
#!/usr/bin/runhugs
> module Main where
> import Distribution.Make
> main :: IO ()
> main = defaultMain
This diff is collapsed.
WithODBC=NO
WithPostgreSQL=NO
WithMySQL=NO
WithSQLite=NO
SO_EXT = so
WIN32=NO
AR = /usr/bin/ar
LD = /usr/bin/ld
INSTALL = /usr/bin/install -c
CPPFLAGS =
LDFLAGS =
HSC2HS = /usr/bin/hsc2hs
HADDOCK = /usr/bin/haddock
DOC_DIR = /tmp/doc/HSQL
GHC = /usr/bin/ghc
GHC_DIR = /tmp/lib/HSQL/GHC
GHC_PKG = /usr/bin/ghc-pkg
HUGS = /usr/bin/hugs
HUGS_DIR = /tmp/lib/HSQL/Hugs
FFIHUGS = /usr/bin/ffihugs
WithODBC=@WithODBC@
WithPostgreSQL=@WithPostgreSQL@
WithMySQL=@WithMySQL@
WithSQLite=@WithSQLite@
SO_EXT = @SO_EXT@
WIN32=@WIN32@
AR = @AR@
LD = @LD@
INSTALL = @INSTALL@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
HSC2HS = @HSC2HS@
HADDOCK = @HADDOCK@
DOC_DIR = @DOC_DIR@
GHC = @GHC@
GHC_DIR = @GHC_DIR@
GHC_PKG = @GHC_PKG@
HUGS = @HUGS@
HUGS_DIR = @HUGS_DIR@
FFIHUGS = @FFIHUGS@
This diff is collapsed.
This diff is collapsed.
AC_INIT([HSQL],[1.0],[htoolkit-users@lists.sourceforge.net],[hsql])
AC_CONFIG_FILES([config.mk:config.mk.in hsql.pkg:hsql.pkg.in])
AC_CANONICAL_SYSTEM
dnl ***********************************************
dnl Enable/Disable ODBC binding
dnl ***********************************************
AC_ARG_ENABLE(odbc,
[ --enable-odbc
Build an ODBC binding for Haskell.
],
[WithODBC=YES],
[WithODBC=NO]
)
AC_SUBST(WithODBC)
dnl ***********************************************
dnl Enable/Disable PostgreSQL binding
dnl ***********************************************
AC_ARG_ENABLE(postgres,
[ --enable-postgres
Build a PostgreSQL binding for Haskell.
],
[WithPostgreSQL=YES],
[WithPostgreSQL=NO]
)
AC_SUBST(WithPostgreSQL)
dnl ***********************************************
dnl Enable/Disable MySQL binding
dnl ***********************************************
AC_ARG_ENABLE(mysql,
[ --enable-mysql
Build a MySQL binding for Haskell.
],
[WithMySQL=YES],
[WithMySQL=NO]
)
AC_SUBST(WithMySQL)
dnl ***********************************************
dnl Enable/Disable SQLite binding
dnl ***********************************************
AC_ARG_ENABLE(sqlite,
[ --enable-sqlite
Build a SQLite binding for Haskell.
],
[WithSQLite=YES],
[WithSQLite=NO]
)
AC_SUBST(WithSQLite)
dnl ***********************************************
dnl GHC
dnl ***********************************************
AC_ARG_WITH(ghc,
[ --with-ghc=<ghc command>
Use a different command instead of 'ghc' for the Haskell compiler.
],
[GHC="$withval"],
[AC_PATH_PROG(GHC,ghc)]
)
if test "$GHC" = "" || test ! -f $GHC; then
AC_MSG_RESULT([The build for GHC will be skiped.])
GHC=""
fi
if test "x$prefix" != xNONE; then
GHC_DIR="$prefix/lib/HSQL/GHC"
else