(Per: Message for you at the bottom!)
Hi Matthew and anyone interested in getting BH non-syntactictower + std-bundled libs + Sack going,
*Objective* To make you get going in a Black Hole environment that's been proven by experience to work very very well, giving a rapid start with 'batteries included'-style nicety, which is of value for those who are at a beginner level in these particular tools and libraries.
*Note on **validity duration of this email* Basically this email ought to be as good as the last said word, until ~February 2013.
Regarding BH, this email and files referred to here will be valid until the BH repos and docs online have been tweaked and a bit restructured. A separate annoncement will be made when this has happened.
Regarding Sack, this email and files referred to here are valid currently. The work needed to make the Sack github repohttps://github.com/pereckerdal/sack/ support both Black Hole versions out of the box is almost nil but has not been done. I'll do this personally at latest at the time the step above is done.
For anyone interested, there's a production-quality HTTPS server extension to Sack. The next days as from this writing, the HTTPS client functionality is tweaked, as well as an asynchronous http* client API introduced, similar to XmlHttpRequest. If you want this, ask for it.
This is a limited-purpose snapshot and for the Black Hole + bundled libs archive, GIT repo files have been duly omitted.
*Prerequisites *Super-basic knowledge of Gambit, in particular naturally understanding when ,q = quit Gambit, is needed.
Gambit installed on your system.
Paths here are written from a Unix point of view but making it go on Windows is straightforward.
Optional: Gambit compiled from source, and the source still available in your home directory (~/gambc-v4*).
*To install these software components, please follow the following installation steps:*
* * Download the archive with non-syntactictower Black Hole and the "bundled libs", + archive overview:*
* Download 2012-11-28-bh-non-syntactictower+bundled-libs.tar.gzavailable for direct download at Gambit's Dumping Grounds pagehttp://dynamo.iro.umontreal.ca/wiki/index.php/Dumping_Grounds#Module_systems . It will be available there for as long as it's not clearly obsolete.
This is a file set that has two parts:
* In the root directory: BH, that equals the legacy branch with pull request 45 linked to above included, though I'm sending it to you separately also just to be really safe you get the right thing.
* In the std/ directory: The "bundled libraries" found on https://github.com/pereckerdal/std , though in a more tested and tried version, and with some extensions.
* Untar this file in your home directory (~), i.e. cd ~; tar xvfz bh-non-syntactictower+bundled-libs.tar.gz .
* Compile Black Hole: cd blackhole; gsc build
* * Set up Black Hole:*
* Make a /usr/bin/bsc file:
cat > /usr/bin/bsc #!/bin/sh gsc -:dar,t8,l30,m20000,-n,tn,f8 -e '(load "~~/lib/blackhole/build.o1")(set! module#*compiler-options* (list (string->symbol "debug")))' $@ - [ctrl+D]
chmod +x /usr/bin/bsc
* Make ~~/lib/blackhole/build.o1 link to ~/blackhole/build.o1: ln -s /usr/local/Gambit-C/lib/blackhole ~/blackhole
* For the package resolver for the std package to find module files, which it looks for in ~~/lib/modules/std : ln -s /usr/local/Gambit-C/lib/modules ~/blackhole
* * * * Set up the bundled libraries:*
* the (std net/tcp-ip) module has some lowlevel dependencies, if you want access to it, copy lib/*.h of your Gambit source distribution into /usr/local/Gambit-C/lib/ i.e. something like: cd ~/gambc-v4[tab] cd lib cp *.h /usr/local/Gambit-C/lib/
* Compile the bundle libraries:
bsc (modules-compile! (modules-in-dir "~~/lib/modules")))
Please note that compiling the (std string/digest) module may occupy ~1.5-2GB memory. The others should be require much less though.
* * Set up the Sack web server and client middleware:*
* Create a project directory for yourself, say ~/proj : mkdir ~/proj; cd ~/proj
* Download the 2012-11-28-sack-current-for-BH-non-syntactictower.tar.gzfile from Gambit's Dumping Grounds pagehttp://dynamo.iro.umontreal.ca/wiki/index.php/Dumping_Grounds#Networking_2. It will be available there for as long as it's not clearly obsolete.
* Unpack Sack into ~/proj/lib : mkdir ~/proj/lib; cd ~/proj/lib; tar xvfz ../sack-current-2012-11-28-for-BH-non-syntactictower.tar.gz; cd ..
* Optional: Compile Sack: bsc (modules-compile! (modules-in-dir "lib/sack")))
*Done!* * * You can now run Gambit with Black Hole from your shell anytime under the name bsc . It's nicely pre-setup with UTF-8 encoding, clear exception reporting, and per-line output buffering for performance (note, invoking |force-output| after any |display| etc. may be needed).
* * *Example HTTP server:*
(presuming you're in ~/proj :)
bsc (import (std misc/u8v) lib/sack/src/server)
(define (simple-webserver! server #!rest rest) (apply sack-start! (cons (lambda (env) (let ((first? #t)) (values 200 '(("Content-Type" . "text/html")) (lambda () (let ((r (and first? (string->utf8-u8vector (server))))) (set! first? #f) r))))) rest)))
(simple-webserver! (lambda () "Hello World!") port-number: 5000)
*Example HTTP client:* (presuming you're in ~/proj :)
bsc
(import (std misc/u8v) lib/sack/src/http-client)
(utf8-u8vector->string (http-response-get-content (http-get-url " http://dynamo.iro.umontreal.ca/wiki/index.php/Main_Page")))
If you have any queries please don't hesitate to ask.
Mikael
(*Per:* Dear Per,
Through this email I'm providing a temporary workaround for the following, though, can you please include this pull request https://github.com/pereckerdal/blackhole/pull/45 in the legacy BH repo?
Matthew and anyone downloading legacy BH from github is experiencing complete malfunction until this pull request is included.
Thanks!)
2012/11/28 Matthew Phillips matthew@phillipsoft.biz
On Wed, Nov 28, 2012 at 3:26 PM, Mikael mikael.rcv@gmail.com wrote:
Ah, noted Sack uses the syntactictower branch's module naming scheme for SRFI:s. Let me know if I should email over one with the non-syntactictower branch's.
Apart from what's released online yet, Sack has stable HTTPS server support, let me know if you want it.
Release of improved HTTPS client support as well as an asynchronous HTTP* client API (akin to the API exported by the web browser XHR object) is underway.
Brgds
If you could send me the Sack that works with the legacy branch, that would be wonderful.
Afficher les réponses par date
On Wed, Nov 28, 2012 at 5:16 PM, Mikael mikael.rcv@gmail.com wrote:
Thanks a lot for putting this together, it is a tremendous value. Couple of notes:
1) You have your ln -s command backwards (I do this all the time ;)) Should be ln -s /path/to/real-thing /path/to/new-link
2) This step doesn't work for me: (modules-compile! (modules-in-dir "~~/lib/modules")))
I get the error :
(modules-compile! (modules-in-dir "~~/lib/modules"))
*** ERROR IN |module#define-syntax|||macro|||| -- Invalid define-syntax form (wrong number of arguments) (define-syntax (lambda (source env mac-env) (let ((code (expr*:value source)... hygiene/1>
I'm guessing there is a third argument (out filename?)??
3) Should be noted for others, you can't compile from the command like this: bsc -exe myfile.scm like you normally would. Instead from the repl: (module-compile-to-standalone "a.out" 'somefile) use that in a script or makefile.
Cheers!
Hi,
2012/11/29 Matthew Phillips matthew@phillipsoft.biz
Thanks a lot for putting this together, it is a tremendous value. Couple of notes:
- You have your ln -s command backwards (I do this all the time ;))
Should be ln -s /path/to/real-thing /path/to/new-link
Ah right.
- This step doesn't work for me: (modules-compile! (modules-in-dir
"~~/lib/modules")))
I get the error :
(modules-compile! (modules-in-dir "~~/lib/modules"))
*** ERROR IN |module#define-syntax|||macro|||| -- Invalid define-syntax form (wrong number of arguments) (define-syntax (lambda (source env mac-env) (let ((code (expr*:value source)... hygiene/1>
I'm guessing there is a third argument (out filename?)??
Uh hmm that looks like an error in a module.
What about you do like this, compile each module in the std dir separately with (module-compile! 'dir/modulename) and check which one it was.
Or just do this by
(for-each (lambda (m) (print "compiling " m "\n") (module-compile! m)) (modules-in-dir "~~/lib/modules"))
and tell what worked and what didn't.
- Should be noted for others, you can't compile from the command like
this: bsc -exe myfile.scm like you normally would. Instead from the repl: (module-compile-to-standalone "a.out" 'somefile) use that in a script or makefile.
Riight.
As for syntactictower Per made some interface equalling -exe though exactly right now the syntactictower is rather for those who want to bring a bit of order, than for those who want to have complete function from the start.
It should not be a lot that needs to be brought to order though at all, from what I can see right now it's a question of maybe 10 hours to bring it to non-syntactictower's level.
If you feel like you can give a shot at it.
And, as for harmonizing non-syntactictower and syntactictower, what shuold be done is 1) Bring a "srfi" package resolver to non-syntactictower and put the srfi:s in there instead of in (std srfi/*). And, 2) Keep the srfi:s in both distros primarily under their number names, and then have "proxy" modules under nice names like "list", "string" etc. (Currently syntactictower has only the latter naming and non-syntactictower only has the further naming.)
This is all.
(And, syntactictower has better macro expansion, caching etc. technology so it's desirable to do this.)
Cheers!
Thanks. Same!