11#! /bin/bash
2- # .binder/postBuild
3-
2+ # Exit script if any command fails
43set -e
54
6- # Install guile-simple-zmq from source
5+ echo " --- 🚀 Starting Guile Kernel setup for Binder ---"
6+
7+ # Define a local installation directory since we don't have sudo
8+ INSTALL_PREFIX=" $HOME /.local"
9+
10+ # Ensure the necessary environment variables are set for the build process
11+ export PKG_CONFIG_PATH=" $INSTALL_PREFIX /lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig"
12+ export GUILE_LOAD_PATH=" $INSTALL_PREFIX /share/guile/site/3.0${GUILE_LOAD_PATH: +: } $GUILE_LOAD_PATH "
13+
14+ # --- Create a workspace for building libraries ---
15+ echo " --- 📂 Creating a temporary 'lib' directory for source files ---"
16+ mkdir lib
17+ cd lib
18+
19+ # --- Install guile-json ---
20+ echo " --- 📦 Installing guile-json ---"
21+ wget https://openbsd.c3sl.ufpr.br/savannah-nongnu/guile-json/guile-json-4.7.1.tar.gz
22+ tar -xzf guile-json-4.7.1.tar.gz
23+ cd guile-json-4.7.1
24+ ./configure --prefix=" $INSTALL_PREFIX "
25+ make
26+ make install
27+ cd ..
28+ # **Cleanup guile-json source folder and tarball**
29+ echo " --- 🧹 Cleaning up guile-json files ---"
30+ rm -rf guile-json-4.7.1 guile-json-4.7.1.tar.gz
31+
32+ # --- Install guile-simple-zmq ---
33+ echo " --- 📦 Installing guile-simple-zmq ---"
734git clone https://github.com/jerry40/guile-simple-zmq.git
835cd guile-simple-zmq
9- autoreconf -vif
10- ./configure
36+ autoreconf --verbose --install --force
37+ ./configure --prefix= " $INSTALL_PREFIX "
1138make
12- sudo make install
39+ make install
1340cd ..
41+ # **Cleanup guile-simple-zmq source folder**
42+ echo " --- 🧹 Cleaning up guile-simple-zmq files ---"
43+ rm -rf guile-simple-zmq
44+
45+ # --- Return to the root project directory ---
46+ cd ..
47+
48+ # --- Configure the Jupyter Kernel ---
49+ echo " --- ⚙️ Configuring Jupyter kernel ---"
50+ echo " --- 📥 Downloading the Guile Kernel source ---"
51+ git clone https://github.com/jerry40/guile-kernel.git
52+
53+ KERNEL_DIR=" $HOME /.local/share/jupyter/kernels/guile"
54+ mkdir -p " $KERNEL_DIR "
55+
56+ # Copy ALL .scm files from the src directory to the kernel directory
57+ cp guile-kernel/src/* .scm " $KERNEL_DIR /"
58+
59+ # **Cleanup the kernel source folder after copying files**
60+ echo " --- 🧹 Cleaning up kernel source files ---"
61+ rm -rf guile-kernel lib
62+
63+ # Create the kernel.json file, dynamically inserting the correct path.
64+ cat << EOF > "$KERNEL_DIR /kernel.json"
65+ {
66+ "argv": [
67+ "guile",
68+ "-L", "$INSTALL_PREFIX /share/guile/site/3.0",
69+ "-s", "$KERNEL_DIR /guile-jupyter-kernel.scm",
70+ "--",
71+ "{connection_file}"
72+ ],
73+ "display_name": "Guile",
74+ "language": "scheme"
75+ }
76+ EOF
1477
15- # Install the jupyter guile kernel from source
16- pip install jupyter-guile-kernel
78+ echo " --- ✨ Guile Kernel setup complete! ---"
0 commit comments