From 3c35564e16b762f6ad1928ab46ece0afc2b59ba1 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 23 May 2015 20:24:13 -0400 Subject: Add new autotools based installation scripts. --- .gitignore | 8 ++++- Makefile | 2 +- README.org | 8 ++--- bootstrap | 3 ++ configure.ac | 8 +++++ dotfiles.scm | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ install.in | 28 +++++++++++++++ install.scm | 92 ------------------------------------------------- package.scm | 22 ++++++++++++ 9 files changed, 183 insertions(+), 99 deletions(-) create mode 100755 bootstrap create mode 100644 configure.ac create mode 100644 dotfiles.scm create mode 100644 install.in delete mode 100755 install.scm create mode 100644 package.scm diff --git a/.gitignore b/.gitignore index e4e5f6c..021d035 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -*~ \ No newline at end of file +*~ +/aclocal.m4 +/autom4te.cache/ +/config.log +/config.status +/configure +/install diff --git a/Makefile b/Makefile index 82d1bc6..09ad410 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ # This makefile might be more useful eventually. install: - ./install.scm + ./install diff --git a/README.org b/README.org index 123c6c0..e0e14f1 100644 --- a/README.org +++ b/README.org @@ -1,11 +1,9 @@ * Dave's Dotfiles - Because all of the cool kids version control their dotfiles. - - Perhaps you are interested in my Emacs configuration. That has its - own repository. [[https://github.com/davexunit/.emacs.d][Check it out.]] + Because all of the cool kids version control their dotfiles, but + only the coolest kids write their own install script in Scheme. ** Installing The dotfiles are installed by creating symlinks from the =dotfiles/= directory to the current user's home directory. - To install, just run =make install=. + To install, just run =./bootstrap && ./configure && make install=. diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..4a4af27 --- /dev/null +++ b/bootstrap @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf -vif \ No newline at end of file diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a1afa14 --- /dev/null +++ b/configure.ac @@ -0,0 +1,8 @@ +dnl -*- Autoconf -*- + +AC_INIT(dotfiles, 0) +AC_CONFIG_FILES([install], [chmod +x install]) + +GUILE_PROGS([2.0.9]) + +AC_OUTPUT diff --git a/dotfiles.scm b/dotfiles.scm new file mode 100644 index 0000000..2553454 --- /dev/null +++ b/dotfiles.scm @@ -0,0 +1,111 @@ +;;; Copyright © 2015 David Thompson +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see +;;; . + +(define-module (dotfiles) + #:use-module (ice-9 ftw) + #:use-module (ice-9 i18n) + #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-26) + #:export (install-dotfiles)) + +(define (recursive-scandir dir) + "Return a list of all the file names in DIR, recursively." + (define (components file) + (string-split file #\/)) + + (define suffix + (let ((prefix-length (length (components dir)))) + (lambda (file) + (string-join (drop (components file) prefix-length) "/")))) + + (define enter? (const #t)) + + ;; Ignore the backup files that Emacs makes. + (define ignore? + (let ((patterns (map make-regexp '("~$" "^\\.#" "^#")))) + (lambda (file) + (let ((base (basename file))) + (any (cut regexp-exec <> base) patterns))))) + + (define (leaf name stat result) + (if (ignore? name) + result + (cons (suffix name) result))) + + ;; No-op + (define (down name stat result) result) + (define (up name stat result) result) + (define (skip name stat result) result) + (define (error name stat errno result) result) + + (let-values (((files discard) + (file-system-fold enter? leaf down up skip error '() dir))) + (sort files string-locale +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see +;;; . + +(define %abs-top-srcdir "@abs_top_srcdir@") + +(set! %load-path (cons %abs-top-srcdir %load-path)) + +(use-modules (dotfiles)) + +(install-dotfiles (string-append %abs-top-srcdir "/dotfiles") + (getenv "HOME")) diff --git a/install.scm b/install.scm deleted file mode 100755 index 7922a48..0000000 --- a/install.scm +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/guile --no-auto-compile -!# - -(use-modules (ice-9 ftw) - (ice-9 i18n) - (ice-9 match) - (srfi srfi-1) - (srfi srfi-11) - (srfi srfi-26)) - -(define (recursive-scandir dir) - "Return a list of all the file names in DIR, recursively." - (define (components file) - (string-split file #\/)) - - (define suffix - (let ((prefix-length (length (components dir)))) - (lambda (file) - (string-join (drop (components file) prefix-length) "/")))) - - (define enter? (const #t)) - - (define (leaf name stat result) - (cons (suffix name) result)) - - ;; No-op - (define (down name stat result) result) - (define (up name stat result) result) - (define (skip name stat result) result) - (define (error name stat errno result) result) - - (let-values (((files discard) - (file-system-fold enter? leaf down up skip error '() dir))) - (sort files string-locale