Skip to content

Commit 1684cb5

Browse files
committed
feat (guile-kernel): stable build
2 parents ed1d3db + 6c7530a commit 1684cb5

5 files changed

Lines changed: 110 additions & 22 deletions

File tree

binder/apt.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
sudo
1+
# Guile Scheme interpreter and development files
22
guile-3.0
33
guile-3.0-dev
4-
automake
5-
build-essential
4+
5+
# ZeroMQ library and headers
66
libzmq3-dev
7-
guile-json
7+
8+
# Standard build tools
9+
build-essential
10+
pkg-config
11+
autoconf
12+
automake
13+
libtool
14+
15+
# Tools for downloading and cloning
16+
git
17+
wget

binder/guile-in-binder.ipynb

Lines changed: 0 additions & 10 deletions
This file was deleted.

binder/postBuild

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,78 @@
11
#!/bin/bash
2-
# .binder/postBuild
3-
2+
# Exit script if any command fails
43
set -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 ---"
734
git clone https://github.com/jerry40/guile-simple-zmq.git
835
cd guile-simple-zmq
9-
autoreconf -vif
10-
./configure
36+
autoreconf --verbose --install --force
37+
./configure --prefix="$INSTALL_PREFIX"
1138
make
12-
sudo make install
39+
make install
1340
cd ..
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! ---"

binder/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
notebook

guile-demo.ipynb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "1558ac60",
7+
"metadata": {
8+
"vscode": {
9+
"languageId": "plaintext"
10+
}
11+
},
12+
"outputs": [],
13+
"source": [
14+
"(display \"Sinta-se à vontade na disciplina de Paradigmas de Programação\")"
15+
]
16+
}
17+
],
18+
"metadata": {
19+
"language_info": {
20+
"name": "python"
21+
}
22+
},
23+
"nbformat": 4,
24+
"nbformat_minor": 5
25+
}

0 commit comments

Comments
 (0)