diff options
| author | krasimir <krasimir@chalmers.se> | 2009-12-13 18:50:29 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-12-13 18:50:29 +0000 |
| commit | f85232947e74ee7ef8c7b0ad2338212e7e68f1be (patch) | |
| tree | 667b886a5e3a4b026a63d4e3597f32497d824761 /deprecated/server | |
| parent | d88a865faff59c98fc91556ff8700b10ee5f2df8 (diff) | |
reorganize the directories under src, and rescue the JavaScript interpreter from deprecated
Diffstat (limited to 'deprecated/server')
| -rw-r--r-- | deprecated/server/Makefile | 59 | ||||
| -rw-r--r-- | deprecated/server/README | 132 |
2 files changed, 191 insertions, 0 deletions
diff --git a/deprecated/server/Makefile b/deprecated/server/Makefile new file mode 100644 index 000000000..7dcf29215 --- /dev/null +++ b/deprecated/server/Makefile @@ -0,0 +1,59 @@ +GFCFLAGS = +RTS -K100M -RTS --cpu + +.PHONY: pgf.fcgi run gwt gf-gwt.jar + +pgf.fcgi: + cabal install + cp dist/build/pgf.fcgi/pgf.fcgi . + +gwt-translate: + chmod a+x gwt/Translate-compile + gwt/Translate-compile + +gwt-fridge: + chmod a+x gwt/Fridge-compile + gwt/Fridge-compile + +gwt-morpho: + chmod a+x gwt/Morpho-compile + gwt/Morpho-compile + +gf-gwt.jar: + mkdir -p gwt/bin/se/chalmers/cs/gf/gwt/client + javac -classpath "$(GWT_CLASSPATH):gwt/lib/gwt-dnd-2.5.6.jar" -sourcepath gwt/src gwt/src/se/chalmers/cs/gf/gwt/client/*.java + jar -cf $@ -C gwt/src se + cp $@ ../../lib/java + +food.pgf: + gfc --make --name=food ../../examples/tutorial/resource-foods/Foods{Eng,Fin,Fre,Ger,Ita,Swe}.gf + +Demo%-parse.pgf: ../../next-lib/src/demo/Demo%.gf + gfc $(GFCFLAGS) --make --erasing=on --name=Demo$*-parse $^ + +Demo%-noparse.pgf: ../../next-lib/src/demo/Demo%.gf + gfc $(GFCFLAGS) --make --parser=off --name=Demo$*-noparse $^ + +Lang%-parse.pgf: ../../next-lib/alltenses/Lang%.gfo + gfc $(GFCFLAGS) --make --erasing=on --name=Lang$*-parse $^ + +Lang%-noparse.pgf: ../../next-lib/alltenses/Lang%.gfo + gfc $(GFCFLAGS) --make --parser=off --name=Lang$*-noparse $^ + +demo.pgf: DemoBul-noparse.pgf DemoCat-noparse.pgf DemoDan-noparse.pgf DemoEng-parse.pgf DemoFin-noparse.pgf DemoFre-noparse.pgf DemoGer-noparse.pgf DemoIta-noparse.pgf DemoNor-noparse.pgf DemoRus-noparse.pgf DemoSpa-noparse.pgf DemoSwe-parse.pgf + gfc $(GFCFLAGS) --name=demo $^ + +lang.pgf: LangBul-noparse.pgf LangCat-noparse.pgf LangDan-parse.pgf LangEng-parse.pgf LangFin-noparse.pgf LangFre-noparse.pgf LangGer-noparse.pgf LangIta-noparse.pgf LangNor-parse.pgf LangRus-noparse.pgf LangSpa-noparse.pgf LangSwe-parse.pgf + gfc $(GFCFLAGS) --name=lang $^ + +test.pgf: LangEng-parse.pgf LangGer-parse.pgf + gfc $(GFCFLAGS) --name=test $^ + +run: pgf.fcgi + @echo '*********************************************' + @echo 'See http://localhost:41296/' + @echo '*********************************************' + lighttpd -f lighttpd.conf -D + +clean: + cabal clean + -rm -f pgf.fcgi
\ No newline at end of file diff --git a/deprecated/server/README b/deprecated/server/README new file mode 100644 index 000000000..a22c596f4 --- /dev/null +++ b/deprecated/server/README @@ -0,0 +1,132 @@ +== Requirements == + +- cabal-install + * See quick installation instructions at the bottom of + http://hackage.haskell.org/trac/hackage/wiki/CabalInstall + +- GF installed as a Cabal package + $ (cd ../.. && cabal install) + +- FastCGI development kit + (MacPorts) $ sudo port install fcgi + (Ubuntu) $ sudo apt-get install libfcgi-dev + +- Google Web Toolkit + - Download from http://code.google.com/webtoolkit/ + - Unpack somewhere. + - Set $GWT_CLASSPATH to point to the GWT JAR files. For example: + $ export GWT_DIR="/Users/bringert/src/gwt-mac-1.5.3" + $ export GWT_CLASSPATH="$GWT_DIR/gwt-user.jar:$GWT_DIR/gwt-dev-mac.jar" + + +== Building == + +- Build pgf.fcgi. This will use cabal to install the dependencies (cgi, fastcgi, json, utf8-string). + $ make + +- Build small example grammar: + $ make food.pgf + $ cp food.pgf grammar.pgf + + +== Running (lighttpd) == + +- Install lighttpd + (MacPorts) $ sudo port install lighttpd + (Ubuntu) $ sudo apt-get install lighttpd + +- Run pgf.fcgi with lighttpd: + $ make run + + +== Testing == + +- First test from the command-line, since debugging is harder from the AJAX UI: + $ curl 'http://localhost:41296/pgf/grammar.pgf/translate?input=this+fish&cat=Item&from=FoodEng' + +- Non-GWT AJAX UI: + See http://localhost:41296/simple-client.html + +- GWT translator: + $ make gwt-translate + Then see http://localhost:41296/translate/ + +- GWT fridge poetry: + $ make gwt-fridge + Then see http://localhost:41296/fridge/ + +- GWT morphology: + $ make gwt-morpho + Then see http://localhost:41296/morpho/ + + The MorphoService.hs module has build-in paths to the grammar that will be loaded. + This have to be fixed by hand + +== Running (Apache) == + +Note: This is more complicated, and the instructions may not be up to date. + +- Make sure that your web server supports FastCGI. For Apache on OS X, + do this: + +$ curl -O http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz +$ tar -zxf mod_fastcgi-2.4.6.tar.gz +$ cd mod_fastcgi-2.4.6/ +$ apxs -o mod_fastcgi.so -c *.c +$ sudo apxs -i -a -n fastcgi mod_fastcgi.so + +- Make sure that your web server knows that gf.fcgi is a FastCGI +program. + +- Make sure that you are allowed to run FastCGI programs in the +directory that you use. + +- With large grammars, gf.fcgi may take long enough to start that the web server +thinks that the program has died. With Apache, you can fix this by adding +"FastCgiConfig -startDelay 30" to your httpd.conf. + +These sections from my Apache config fixes the above two +(some of this may be fixed by the second apxs command above): + +(On OS X, this is in /etc/httpd/httpd.conf) + +LoadModule fastcgi_module libexec/httpd/mod_fastcgi.so +AddModule mod_fastcgi.c + +<IfModule mod_fastcgi.c> + FastCgiIpcDir /tmp/fcgi_ipc/ + AddHandler fastcgi-script .fcgi + FastCgiConfig -startDelay 30 +</IfModule> + + +(On OS X, this is in /etc/httpd/users/bringert.conf) + +<Directory "/Users/bringert/Sites/"> + Options Indexes MultiViews FollowSymlinks ExecCGI + AddHandler cgi-script .cgi + AllowOverride None + Order allow,deny + Allow from all +</Directory> + +- If you have changed the web server config, you need to restart the web server + (this is also useful to get a clean slate if you end up with dead or resource-hogging + FastCGI processes): + +$ sudo apachectl restart + +- If Apache complains about a syntax error on the FastCgiIpcDir line, try deleting + any existing /tmp/fcgi_ipc/ directory: + +$ sudo rm -rf /tmp/fcgi_ipc/ + +- Copy or symlink this directory to your web directory. + +- First test from the command-line, since debugging is harder from the AJAX UI: + +$ curl 'http://localhost/~bringert/gf-server/gf.fcgi/translate?input=this+fish&cat=Item&from=FoodEng' + +- Check server logs (e.g. /var/log/httpd/error_log) if it doesn't work. + +- Go to SERVER_URL/simple-client.html in your web browser. |
