(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 repo 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.gz available for direct download at Gambit's Dumping Grounds pageIt 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.gz file from Gambit's Dumping Grounds page. 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.