diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..7c4b105 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Christoph de Mattia diff --git a/Makefile.am b/Makefile.am index 55d52f0..0ec1954 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = c -EXTRA_DIST = c/ncurses.c \ +EXTRA_DIST = c/ncurses.c \ scheme/ncurses-interfaces.scm \ - scheme/ncurses-packages.scm \ - scheme/ncurses.scm \ + scheme/scsh-package.scm \ + scheme/ncurses.scm \ + scheme/ncurses-constants.scm \ pkg-def.scm diff --git a/c/Makefile.am b/c/Makefile.am new file mode 100644 index 0000000..c51321e --- /dev/null +++ b/c/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I@top_srcdir@/c -I@scsh_includes@ + +libsys_LTLIBRARIES = libscshncurses.la + +libscshncurses_la_SOURCES = ncurses.c + +libscshncurses_la_LIBADD = -lncurses +libscshncurses_la_LDFLAGS = -version-info 1:0:0 -module diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..13bf091 --- /dev/null +++ b/configure.in @@ -0,0 +1,30 @@ +AC_INIT(scsh-ncurses, 0.1) +AM_INIT_AUTOMAKE + +AC_CONFIG_SRCDIR(configure.in) +AC_LANG(C) + +define([PREPEND], [[$2]="$[$2] [$1]"]) + +AC_PROG_LIBTOOL +AC_PROG_CC + +AC_ARG_WITH(scsh-includes, + AC_HELP_STRING([--with-scsh-includes=DIR], + [scsh include files are in DIR [/usr/local/include]]), + scsh_includes=$withval, + scsh_includes=/usr/local/include) +AC_SUBST(scsh_includes) + +missing_yp_funs="" + +schemedir='${prefix}'"/scheme" +libdir='${prefix}'"/lib" +libsysdir='${prefix}' + +AC_SUBST(libdir) +AC_SUBST(libsysdir) +AC_SUBST(schemedir) +AC_SUBST(LIBS) +AC_SUBST(CC) +AC_OUTPUT([Makefile c/Makefile]) \ No newline at end of file diff --git a/pkg-def.scm b/pkg-def.scm new file mode 100644 index 0000000..99eda60 --- /dev/null +++ b/pkg-def.scm @@ -0,0 +1,62 @@ +(define-package "scsh-ncurses" (0 1) + ((install-lib-version (1 0))) + + (display "configuring, compiling and installing c-stubs") + (newline) + + (let* ((scsh-includes (include-dir)) + (build-host (get-option-value 'build)) + (prefix (string-append (get-directory 'lib #f) "/" build-host)) + (configure `("./configure" + ,(string-append "--prefix=" prefix) + ,(string-append "--with-scsh-includes=" scsh-includes) + ,(string-append "--enable-static=no") + ,(string-append "--build=" build-host))) + (make `(make install + ,(string-append "DESTDIR=" (get-option-value 'dest-dir))))) + + (if (get-option-value 'dry-run) + (begin + (display configure) + (newline) + (display make) + (newline)) + (if (not (and (zero? (run ,configure)) + (zero? (run ,make)))) + (exit)))) + + (display "creating load.scm") + (newline) + + (let ((schemedir (get-directory 'scheme #f)) + (libdir (get-directory 'lib #f))) + (write-to-load-script + `((user) + (load-package 'dynamic-externals) + (open 'dynamic-externals) + (open 'external-calls) + (open 'configure) + (open 'signals) + ,@(map (lambda (x) `(run ',x)) tmpl-libtool-la-reader) + (run '(let* ((lib-dir (string-append ,libdir "/" (host))) + (la-file-name (string-append lib-dir "/libscshncurses.la")) + (initializer-name "s48_init_ncurses")) + (let ((la-alist (read-libtool-la la-file-name))) + (cond + ((assoc 'dlname la-alist) + => (lambda (p) + (let ((module-file (string-append lib-dir "/" (cdr p)))) + (dynamic-load module-file) + (call-external (get-external initializer-name))))) + (else + (error "Could not figure out libscshncurses' name" la-file-name)))))) + (config) + (load ,(string-append schemedir "/ncurses-packages.scm")) + (user)))) + + (display "installing") + (newline) + + (install-directory-contents "scheme" 'scheme) +; (install-file '("COPYING" . "LICENSE") 'doc) +)