Setup infrastructure

This commit is contained in:
Juliana Rat 2023-11-03 22:15:23 -04:00
parent bfafbbe8dc
commit 3d1d63d050
9 changed files with 296 additions and 78 deletions

65
.gitignore vendored Normal file
View File

@ -0,0 +1,65 @@
*.eps
*.go
*.log
*.pdf
*.png
*.tar.xz
*.tar.gz
*.tmp
*~
.#*
\#*\#
,*
/ABOUT-NLS
/INSTALL
/aclocal.m4
/autom4te.cache
/build-aux/ar-lib
/build-aux/compile
/build-aux/config.guess
/build-aux/config.rpath
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/mdate-sh
/build-aux/missing
/build-aux/test-driver
/build-aux/texinfo.tex
/config.status
/configure
/doc/*.1
/doc/.dirstamp
/doc/contributing.*.texi
/doc/*.aux
/doc/*.cp
/doc/*.cps
/doc/*.fn
/doc/*.fns
/doc/*.html
/doc/*.info
/doc/*.info-[0-9]
/doc/*.ky
/doc/*.pg
/doc/*.toc
/doc/*.t2p
/doc/*.tp
/doc/*.vr
/doc/*.vrs
/doc/stamp-vti
/doc/version.texi
/doc/version-*.texi
/m4/*
/pre-inst-env
/test-env
/test-tmp
/tests/*.trs
GPATH
GRTAGS
GTAGS
Makefile
Makefile.in
config.cache
stamp-h[0-9]
tmp
/.version
/doc/stamp-[0-9]

48
HACKING
View File

@ -1,48 +0,0 @@
# -*- mode: org; coding: utf-8; -*-
#+TITLE: Hacking sloth
* Contributing
By far the easiest way to hack on sloth is to develop using Guix:
#+BEGIN_SRC bash
# Obtain the source code
cd /path/to/source-code
guix environment -l guix.scm
# In the new shell, run:
hall dist --execute && autoreconf -vif && ./configure && make check
#+END_SRC
You can now hack this project's files to your heart's content, whilst
testing them from your `guix environment' shell.
To try out any scripts in the project you can now use
#+BEGIN_SRC bash
./pre-inst-env scripts/${script-name}
#+END_SRC
If you'd like to tidy the project again, but retain the ability to test the
project from the commandline, simply run:
#+BEGIN_SRC bash
./hall clean --skip "scripts/${script-name},pre-inst-env" --execute
#+END_SRC
** Manual Installation
If you do not yet use Guix, you will have to install this project's
dependencies manually:
- autoconf
- automake
- pkg-config
- texinfo
- guile-hall
- guile-ts
Once those dependencies are installed you can run:
#+BEGIN_SRC bash
hall dist -x && autoreconf -vif && ./configure && make check
#+END_SRC

View File

4
README
View File

@ -1,4 +0,0 @@
# -*- mode: org; coding: utf-8; -*-
#+TITLE: README for Sloth

1
README Symbolic link
View File

@ -0,0 +1 @@
README.org

View File

@ -2,29 +2,87 @@
(guix packages)
((guix licenses) #:prefix license:)
(guix download)
(guix gexp)
(guix build-system gnu)
(gnu packages)
(gnu packages autotools)
(gnu packages guile)
(gnu packages guile-xyz)
(gnu packages pkg-config)
(gnu packages texinfo))
(gnu packages texinfo)
(srfi srfi-1))
(package
(name "sloth")
(version "0.1")
(source "./sloth-0.1.tar.gz")
(version "0.1-dev")
(source
(local-file
(dirname (current-filename))
#:recursive?
#t
#:select?
(λ (file stat)
(not (any (λ (my-string)
(string-contains file my-string))
(list ".git" ".dir-locals.el" "guix.scm"))))))
(build-system gnu-build-system)
(arguments `())
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("pkg-config" ,pkg-config)
("texinfo" ,texinfo)))
(inputs `(("guile" ,guile-3.0)))
(propagated-inputs `())
(synopsis "")
(description "")
(home-page "")
(arguments
(list
#:make-flags
#~(list "GUILE_AUTO_COMPILE=0")
#:phases
#~(modify-phases %standard-phases
(delete 'strip)
(add-before 'configure 'hall-build
(λ _ (system* "hall" "build" "-x")))
(add-after 'hall-build 'autoreconf
(λ _ (system* "autoreconf" "-vif")))
(add-after 'install 'hall-wrap-binaries
(λ _
(use-modules (ice-9 ftw))
(define (compiled-dir out version)
(string-append out "/lib/guile/"
version
"/site-ccache"))
(define (uncompiled-dir out version)
(string-append out
"/share/guile/site"
(if (string-null? version) ""
"/")
version))
(define (dep-path env modules path)
(list env ":"
'prefix
(cons modules
(map (λ (input)
(string-append input path))
(list #$guile-config
#$guile-ncurses
#$guile-ts)))))
(define bin (string-append #$output "/bin/"))
(define site (uncompiled-dir #$output ""))
(define version (caddr (scandir site)))
(wrap-program (string-append bin "sloth")
(dep-path
"GUILE_LOAD_PATH"
(uncompiled-dir #$output version)
(uncompiled-dir "" version))
(dep-path
"GUILE_LOAD_COMPILED_PATH"
(compiled-dir #$output version)
(compiled-dir "" version))))))))
(native-inputs (list autoconf
automake
guile-hall
pkg-config
texinfo))
(inputs (list guile-3.0))
(propagated-inputs (list guile-config
guile-ncurses
guile-ts))
(synopsis "Text editor based on tree-sitter")
(description
"TODO")
(home-page "https://git.solarpunk.moe/Sloth/sloth")
(license license:gpl3+))

View File

@ -3,24 +3,28 @@
(prefix "")
(version "0.1")
(author "An owl and a rat")
(email "stellarskylark@posteo.net")
(copyright (2023))
(synopsis "")
(description "")
(home-page "")
(license gpl3+)
(dependencies `(("guile-ts" ,guile-ts)))
(dependencies `(("guile-config" ,guile-config)
("guile-ncurses" ,guile-ncurses)
("guile-ts" ,guile-ts)))
(skip ())
(files (libraries
((directory "sloth" ()) (scheme-file "sloth")))
((directory "sloth" ())))
(tests ((directory "tests" ())))
(programs ((directory "scripts" ())))
(programs
((directory "scripts" ((in-file "sloth")))))
(documentation
((directory "doc" ((texi-file "sloth")))
(text-file "COPYING")
(text-file "HACKING")
(symlink "README" "README.org")
(text-file "LICENSE")
(symlink "README" "README.org")
(org-file "README")))
(infrastructure
((scheme-file "hall")
(text-file ".gitignore")
(scheme-file "guix")))))
((text-file ".gitignore")
(scheme-file "guix")
(scheme-file "hall")
(scheme-file "manifest")))))

90
manifest.scm Normal file
View File

@ -0,0 +1,90 @@
;; Development dependencies for Sloth
;; Because both Hall and Guix are being used for development, these are just the
;; tools to build things using those tools. Notably, running a guix shell
;; container with only these packages should be comfortable.
;; Usage: guix shell -[CNW]m manifest.scm
(use-modules (gnu packages autotools)
(gnu packages base)
(gnu packages guile)
(gnu packages guile-xyz)
(gnu packages pkg-config)
(gnu packages readline)
(gnu packages texinfo)
(gnu packages version-control)
(guix build-system gnu)
(guix git-download)
((guix licenses)
#:prefix license:)
(guix packages))
(define guile-hall-next
(package
(name "guile-hall")
(version "0.4.1-next")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.com/a-sassmannshausen/guile-hall")
(commit "9ca0c3e")))
(file-name (git-file-name name version))
(sha256
(base32 "0fi7isi5wq6awssk08zj4scifrb9g1g1027id5j87awb29q22jlj"))))
(build-system gnu-build-system)
(arguments
(list #:phases
#~(modify-phases %standard-phases
(add-after 'install 'hall-wrap-binaries
(lambda _
(use-modules (ice-9 ftw))
(define (compiled-dir out version)
(string-append out "/lib/guile/"
version
"/site-ccache"))
(define (uncompiled-dir out version)
(string-append out
"/share/guile/site"
(if (string-null? version) ""
"/")
version))
(define (dep-path env modules path)
(list env ":"
'prefix
(cons modules
(map (lambda (input)
(string-append input path))
(list #$guile-config)))))
(define bin (string-append #$output "/bin/"))
(define site (uncompiled-dir #$output ""))
(define version (caddr (scandir site)))
(wrap-program (string-append bin "hall")
(dep-path
"GUILE_LOAD_PATH"
(uncompiled-dir #$output version)
(uncompiled-dir "" version))
(dep-path
"GUILE_LOAD_COMPILED_PATH"
(compiled-dir #$output version)
(compiled-dir "" version))))))))
(native-inputs (list autoconf
automake
pkg-config
texinfo))
(inputs (list guile-3.0))
(propagated-inputs (list guile-config))
(synopsis "Guile project tooling")
(description
"Hall is a command-line application and a set of Guile libraries that
allow you to quickly create and publish Guile projects. It allows you to
transparently support the GNU build system, manage a project hierarchy &
provides tight coupling to Guix.")
(home-page "https://gitlab.com/a-sassmannshausen/guile-hall")
(license license:gpl3+)))
(packages->manifest
(list coreutils
git
guile-3.0
guile-hall-next
guile-readline))

55
scripts/sloth.in Normal file
View File

@ -0,0 +1,55 @@
#!@GUILE@ \
--no-auto-compile -e main -s
!#
;; bin/sloth --- sloth text editor -*- coding: utf-8 -*-
;;; Commentary:
;;;
;;; This is the entry file for sloth.
;;;
;;; Code:
(use-modules (config)
(config api)
(config licenses)
(config parser sexp))
;; Commandline handling
(define %configuration
(configuration
(name 'sloth)
(version @HVERSION@)
(author @AUTHOR@)
(copyright @COPYRIGHT@)
(license @LICENSE@)
(synopsis "Text editor based on tree-sitter")
(description
"TODO")
(arguments
(list
(argument (name 'file)
(handle file-exists?)
(synopsis "The file to open")
(example "./file.txt"))))
(directory (in-home ".config/"))
(parser simple-sexp-parser)
(generate-cmdtree? #t)))
(define (main args)
"(Listof String) -> Int
program entrypoint; handle commandline args and call appropriate procedures"
(define options (getopt-config-auto args %configuration))
(display (full-command options))
(newline)
#;
(match (full-command options) ;
((_ file) ;
(open file)) ;
((_) ;
(new-instance))))
;;; Local Variables:
;;; mode: scheme
;;; End:

View File

@ -1,3 +0,0 @@
(use-modules (ts))
(display "haha i do not yet perform any useful tasks")