about summary refs log tree commit diff
path: root/sent
diff options
context:
space:
mode:
Diffstat (limited to 'sent')
-rw-r--r--sent/README.md17
-rw-r--r--sent/make.scm66
-rw-r--r--sent/slides5
3 files changed, 88 insertions, 0 deletions
diff --git a/sent/README.md b/sent/README.md
new file mode 100644
index 0000000..fdf3e1a
--- /dev/null
+++ b/sent/README.md
@@ -0,0 +1,17 @@
+Download the release tarball.
+```
+wget https://dl.suckless.org/tools/sent-1.tar.gz
+```
+Unforuntately, that's a tar bomb. So, extract it carefully into a new directory.
+```
+mkdir sent
+tar -C sent -xvf sent-1.tar.gz
+```
+Build it using our G-expression based build system.
+```
+guix build -f make.scm
+```
+Run sent on the example slides.
+```
+$(guix build -f make.scm) sent/example
+```
diff --git a/sent/make.scm b/sent/make.scm
new file mode 100644
index 0000000..2ec3034
--- /dev/null
+++ b/sent/make.scm
@@ -0,0 +1,66 @@
+(use-modules (gnu packages commencement)
+             (gnu packages fontutils)
+             (gnu packages xorg)
+             (guix gexp))
+
+(define set-up-gcc-gexp
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (set-path-environment-variable "PATH"
+                                       '("bin")
+                                       (list #$gcc-toolchain))
+        (set-path-environment-variable "C_INCLUDE_PATH"
+                                       '("include")
+                                       (list #$gcc-toolchain))
+        (set-path-environment-variable "LIBRARY_PATH"
+                                       '("lib")
+                                       (list #$gcc-toolchain)))))
+
+(define* (compile source-filename #:key (flags '()))
+  (computed-file (string-append (basename source-filename ".c")
+                                ".o")
+                 #~(begin
+                     #$set-up-gcc-gexp
+                     (invoke "gcc" "-c" #$(local-file source-filename)
+                             "-o" #$output
+                             #$@flags))))
+
+(define* (link output-filename object-files #:key (flags '()))
+  (computed-file output-filename
+                 #~(begin
+                     #$set-up-gcc-gexp
+                     (invoke "gcc" "-o" #$output
+                             #$@object-files
+                             #$@flags))))
+
+(let ((include-dependencies
+       (directory-union "include"
+                        (list (file-append fontconfig "/include")
+                              (file-append freetype "/include/freetype2")
+                              (file-append libx11 "/include")
+                              (file-append libxft "/include")
+                              (file-append libxrender "/include")
+                              (file-append xorgproto "/include")))))
+  (link "sent"
+        (list (compile "sent/sent.c"
+                       #:flags (list "-DVERSION=\"1\""
+                                     "-I" include-dependencies
+                                     "-I" (file-union "include"
+                                                      `(("arg.h" ,(local-file "sent/arg.h"))
+                                                        ("config.h" ,(local-file "sent/config.def.h"))
+                                                        ("drw.h" ,(local-file "sent/drw.h"))
+                                                        ("util.h" ,(local-file "sent/util.h"))))))
+              (compile "sent/drw.c"
+                       #:flags (list "-I" include-dependencies
+                                     "-I" (file-union "include"
+                                                      `(("drw.h" ,(local-file "sent/drw.h"))
+                                                        ("util.h" ,(local-file "sent/util.h"))))))
+              (compile "sent/util.c"
+                       #:flags (list "-I" (file-union "include"
+                                                      `(("util.h" ,(local-file "sent/util.h")))))))
+        #:flags (list "-L" (file-append fontconfig "/lib")
+                      "-L" (file-append libx11 "/lib")
+                      "-L" (file-append libxft "/lib")
+                      "-lfontconfig" "-lm" "-lX11" "-lXft")))
diff --git a/sent/slides b/sent/slides
new file mode 100644
index 0000000..c56b632
--- /dev/null
+++ b/sent/slides
@@ -0,0 +1,5 @@
+test slide 1
+
+test slide 2
+
+Thank you!
\ No newline at end of file