Haskellで書かれたCMS「clckwrks」を使ってみよう

http://www.clckwrks.com/

"Get started"

Get startedページにいきましょう。

makeでwgetのエラーがでるので"--no-check-certificate"をいれてあげましょう。

~/Documents/.../clckwrks/clckwrks $ cat Makefile

WGET=wget --no-check-certificate
all: json2/json2.js jstree/jquery.jstree.js jquery/jquery.js

json2/json2.js:
	mkdir -p json2
	$(WGET) https://raw.github.com/douglascrockford/JSON-js/master/json2.js -O json2/json2.js

jstree/jquery.jstree.js:
	mkdir -p jstree
	$(WGET) --no-check-certificate http://github.com/downloads/vakata/jstree/jstree_pre1.0_fix_1.zip -O jstree/jstree_pre1.0_fix_1.zip
	cd jstree ; unzip jstree_pre1.0_fix_1.zip

jquery/jquery.js:
	mkdir -p jquery
	$(WGET) http://code.jquery.com/jquery-1.7.2.js -O jquery/jquery.js

README.html: README.md Makefile
	echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"" > $@
	echo "    \"http://www.w3.org/TR/html4/strict.dtd\">" >> $@
	echo "<html><head><title>happstack-lite tutorial</title><link rel='stylesheet' type='text/css' href='hscolour.css' ></head><body>" >> $@
	HsColour -lit -css -partial $< | markdown --html4tags >> $@
	echo "</body></html>">> $@
	validate $@

.PHONY: all

で以下のディレクトリに移ってcabal installを実行しなさいとのこと。

clckwrks
clckwrks-cli
clckwrks-plugin-media
clckwrks-plugin-bugs
clckwrks-theme-clcwrks
clckwrks-dot-com

clckwrksでcabal installをしたらhappstack-authenticateが必要だったのことでcabal install happstack-authenticateをしたらエラーです。

...
cabal: Error: some packages failed to install:
happstack-authenticate-0.9.2 depends on ixset-1.0.4 which failed to install.
ixset-1.0.4 failed during the building phase. The exception was:
ExitFailure 1
suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks
~/Documents/.../clckwrks/clckwrks $ cabal install ixset
Resolving dependencies...
Configuring ixset-1.0.4...
Building ixset-1.0.4...
Preprocessing library ixset-1.0.4...
[1 of 2] Compiling Data.IxSet.Ix    ( src/Data/IxSet/Ix.hs, dist/build/Data/IxSet/Ix.o )
[2 of 2] Compiling Data.IxSet       ( src/Data/IxSet.hs, dist/build/Data/IxSet.o )
ghc: unrecognised flags: - -
Usage: For basic information, try the `--help' option.
cabal: Error: some packages failed to install:
ixset-1.0.4 failed during the building phase. The exception was:
ExitFailure 1

ixset-1.0.4は調子が悪いようです。

suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks
~/Documents/.../clckwrks/clckwrks $ cabal info happstack-authenticate
* happstack-authenticate (library)
    Synopsis:      Happstack Authentication Library
    Versions available: 0.9.2
    Versions installed: [ Not installed ]
    Homepage:      http://src.seereason.com/happstack-authenticate
    Bug reports:   [ Not specified ]
    Description:   A themeable authentication library with support for
                   username+password and OpenId.
    Category:      Web
    License:       BSD3
    Author:        Jeremy Shaw.
    Maintainer:    jeremy@seereason.com
    Source repo:   [ Not specified ]
    Dependencies:  base >4 && <5, acid-state ==0.6.*, aeson >=0.4 && <0.7,
                   authenticate ==1.2.*, blaze-html ==0.5.*, bytestring ==0.9.*,
                   containers ==0.4.*, ixset ==1.0.*,
                   happstack-server >=6.0 && <7.1, http-conduit ==1.4.*,
                   http-types ==0.6.*, fb ==0.9.*, safecopy ==0.6.*, mtl >=2.0,
                   pwstore-purehaskell ==2.1.*, QuickCheck >=2, text ==0.11.*,
                   time >=1.2 && <1.5, reform ==0.1.*, reform-blaze ==0.1.*,
                   reform-happstack ==0.1.*, unordered-containers ==0.2.*,
                   web-routes >=0.26 && <0.28, web-routes-happstack ==0.23.*
    Cached:        No
    Modules:
        Happstack.Auth
        Happstack.Auth.Blaze.Templates
        Happstack.Auth.Core.Auth
        Happstack.Auth.Core.AuthParts
        Happstack.Auth.Core.AuthProfileURL
        Happstack.Auth.Core.AuthURL
        Happstack.Auth.Core.Profile
        Happstack.Auth.Core.ProfileParts
        Happstack.Auth.Core.ProfileURL

ixset ==1.0.*ならいいそうなのでixset-1.0.3を使ってみます。

Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/happstack-authenticate-0.9.2/lib
Registering happstack-authenticate-0.9.2...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html

成功です。

気を取り直してclckwrksディレクトリでcabal install。なかなか時間がかかります。

Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/clckwrks-0.8.3/lib
Registering clckwrks-0.8.3...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html


clckwrks-plugin-mediaは画像系のCライブラリが必要なようです。

~/Documents/.../clckwrks/clckwrks-plugin-media $ cabal install               
Resolving dependencies...
Downloading gd-3000.7.3...
Configuring gd-3000.7.3...
cabal: Missing dependencies on foreign libraries:
* Missing (or bad) header file: gd.h
* Missing C libraries: gd, png, jpeg, fontconfig, freetype
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Downloading magic-1.0.8...
Configuring magic-1.0.8...
cabal: Missing dependency on a foreign library:
* Missing C library: magic
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
clckwrks-plugin-media-0.2.2 depends on magic-1.0.8 which failed to install.
gd-3000.7.3 failed during the configure step. The exception was:
ExitFailure 1
magic-1.0.8 failed during the configure step. The exception was:
ExitFailure 1
cabal unpack --verbose=3 gd
export C_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib
cabal install

Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/gd-3000.7.3/lib
Registering gd-3000.7.3...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html
suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/gd-3000.7.3

gdをインストールできた。

~/Documents/.../clckwrks/clckwrks-plugin-media $ cabal install
Resolving dependencies...
Configuring magic-1.0.8...
cabal: Missing dependency on a foreign library:
* Missing C library: magic
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
clckwrks-plugin-media-0.2.2 depends on magic-1.0.8 which failed to install.
magic-1.0.8 failed during the configure step. The exception was:
ExitFailure 1
suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks-plugin-media
~/Documents/.../clckwrks/clckwrks-plugin-media $ cabal install magic-1.0.8
Resolving dependencies...
Configuring magic-1.0.8...
cabal: Missing dependency on a foreign library:
* Missing C library: magic
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
magic-1.0.8 failed during the configure step. The exception was:
ExitFailure 1

libmagicが必要。macportではlibmagicはfileに含まれているらしい。

sudo port install file

で/opt/local/libにlibmagicで始まるファイルがインストールされているので、clckwrks-plugin-mediaがインストールできるはず。

suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks-plugin-media
~/Documents/.../clckwrks/clckwrks-plugin-media $ cabal install
Resolving dependencies...
Configuring magic-1.0.8...
Building magic-1.0.8...
Preprocessing library magic-1.0.8...
ld: warning: in /opt/local/lib/libmagic.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libmagic.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libmagic.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libmagic.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libmagic.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
[1 of 7] Compiling Magic.TypesLL    ( Magic/TypesLL.hs, dist/build/Magic/TypesLL.o )
[2 of 7] Compiling Magic.Data       ( dist/build/Magic/Data.hs, dist/build/Magic/Data.o )
[3 of 7] Compiling Magic.Types      ( dist/build/Magic/Types.hs, dist/build/Magic/Types.o )
[4 of 7] Compiling Magic.Utils      ( dist/build/Magic/Utils.hs, dist/build/Magic/Utils.o )
[5 of 7] Compiling Magic.Init       ( dist/build/Magic/Init.hs, dist/build/Magic/Init.o )
[6 of 7] Compiling Magic.Operations ( dist/build/Magic/Operations.hs, dist/build/Magic/Operations.o )
[7 of 7] Compiling Magic            ( Magic.hs, dist/build/Magic.o )
[1 of 7] Compiling Magic.TypesLL    ( Magic/TypesLL.hs, dist/build/Magic/TypesLL.p_o )
[2 of 7] Compiling Magic.Data       ( dist/build/Magic/Data.hs, dist/build/Magic/Data.p_o )
[3 of 7] Compiling Magic.Types      ( dist/build/Magic/Types.hs, dist/build/Magic/Types.p_o )
[4 of 7] Compiling Magic.Utils      ( dist/build/Magic/Utils.hs, dist/build/Magic/Utils.p_o )
[5 of 7] Compiling Magic.Init       ( dist/build/Magic/Init.hs, dist/build/Magic/Init.p_o )
[6 of 7] Compiling Magic.Operations ( dist/build/Magic/Operations.hs, dist/build/Magic/Operations.p_o )
[7 of 7] Compiling Magic            ( Magic.hs, dist/build/Magic.p_o )
Registering magic-1.0.8...
Running Haddock for magic-1.0.8...
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: rts-1.0
Preprocessing library magic-1.0.8...
Haddock coverage:
  50% (  1 /  2) in 'Magic.TypesLL'
  50% (  1 /  2) in 'Magic.Data'
  67% (  2 /  3) in 'Magic.Types'
  17% (  1 /  6) in 'Magic.Utils'
 100% (  4 /  4) in 'Magic.Init'
 100% (  9 /  9) in 'Magic.Operations'
 100% (  7 /  7) in 'Magic'
Warning: Magic.Types: could not find link destinations for:
    Magic.TypesLL.CMagic
Documentation created: dist/doc/html/magic/index.html
Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/magic-1.0.8/lib
Registering magic-1.0.8...
[1 of 1] Compiling Main             ( Setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
ld: warning: in /opt/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_iconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_close)
  "_locale_charset", referenced from:
      _localeEncoding in libHSbase-4.5.0.0.a(PrelIOUtils.o)
  "_iconv", referenced from:
      _hs_iconv in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding5_info, _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding3_info , _hs_iconv_close )
  "_iconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_open)
ld: symbol(s) not found
collect2: ld returned 1 exit status
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
clckwrks-plugin-media-0.2.2 failed during the configure step. The exception
was:
ExitFailure 1

\(^o^)/