Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Generate a template for Gauche package
Browse files Browse the repository at this point in the history
  • Loading branch information
kana committed May 17, 2011
0 parents commit b0fe145
Show file tree
Hide file tree
Showing 8 changed files with 313 additions and 0 deletions.
43 changes: 43 additions & 0 deletions DIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
#
# A helper script for developers.
# ./DIST gen : runs autoconf to generate 'configure' script.
# ./DIST tgz : creates a tarball.
# Assumes gnu tar.

MODULE=gauche-vim-xire

while [ $# -gt 0 ]; do
case $1 in
gen) gen=yes; shift ;;
tgz) tgz=yes; shift ;;
*) echo "DIST gen|tgz"; exit 0;;
esac
done

if [ "$gen" = "yes" ]; then
autoconf
fi

if [ "$tgz" = "yes" ]; then
if [ -f Makefile ]; then make maintainer-clean; fi
./DIST gen
./configure
make distclean

if [ ! -f VERSION ]; then echo "No VERSION; something wrong?"; exit 1; fi
VERSION=`cat VERSION`

rm -f DIST_EXCLUDE_X
echo DIST > DIST_EXCLUDE_X
echo DIST_EXCLUDE_X >> DIST_EXCLUDE_X
if [ -f DIST_EXCLUDE ]; then cat DIST_EXCLUDE >> DIST_EXCLUDE_X; fi
find . -name CVS -o -name .svn -print -prune >> DIST_EXCLUDE_X

rm -rf ../$MODULE-$VERSION

mkdir ../$MODULE-$VERSION
tar cvfX - DIST_EXCLUDE_X . | (cd ../$MODULE-$VERSION; tar xf -)
(cd ..; tar cvf - $MODULE-$VERSION | gzip -9 > $MODULE-$VERSION.tgz)
(cd ..; rm -rf $MODULE-$VERSION)
fi
78 changes: 78 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#
# $Id: template.Makefile.in,v 1.8 2008-04-18 12:36:26 shirok Exp $
#

# General info
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
datadir = @datadir@
datarootdir = @datarootdir@
srcdir = @srcdir@
VPATH = $(srcdir)

# These may be overridden by make invocators
DESTDIR =
GOSH = @GOSH@
GAUCHE_CONFIG = @GAUCHE_CONFIG@
GAUCHE_PACKAGE = @GAUCHE_PACKAGE@
INSTALL = @GAUCHE_INSTALL@ -C

# Other parameters
SOEXT = @SOEXT@
OBJEXT = @OBJEXT@
EXEEXT = @EXEEXT@
LOCAL_PATHS = @LOCAL_PATHS@

# Module-specific stuff
PACKAGE = gauche-vim-xire

ARCHFILES = gauche_vim_xire.$(SOEXT)
SCMFILES = $(srcdir)/vim/xire.scm
HEADERS =

TARGET = $(ARCHFILES)
GENERATED =
CONFIG_GENERATED = Makefile config.cache config.log config.status \
configure.lineno autom4te*.cache $(PACKAGE).gpd

GAUCHE_PKGINCDIR = $(DESTDIR)@GAUCHE_PKGINCDIR@
GAUCHE_PKGLIBDIR = $(DESTDIR)@GAUCHE_PKGLIBDIR@
GAUCHE_PKGARCHDIR = $(DESTDIR)@GAUCHE_PKGARCHDIR@

gauche_vim_xire_SRCS = $(srcdir)/gauche_vim_xire.c $(srcdir)/gauche_vim_xirelib.stub

all : $(TARGET)

gauche_vim_xire.$(SOEXT): $(gauche_vim_xire_SRCS)
$(GAUCHE_PACKAGE) compile \
--local=$(LOCAL_PATHS) --verbose gauche_vim_xire $(gauche_vim_xire_SRCS)

check : all
@rm -f test.log
$(GOSH) -I. -I$(srcdir) $(srcdir)/test.scm > test.log

install : all
$(INSTALL) -m 444 -T $(GAUCHE_PKGINCDIR) $(HEADERS)
$(INSTALL) -m 444 -T $(GAUCHE_PKGLIBDIR) $(SCMFILES)
$(INSTALL) -m 555 -T $(GAUCHE_PKGARCHDIR) $(ARCHFILES)
$(INSTALL) -m 444 -T $(GAUCHE_PKGLIBDIR)/.packages $(PACKAGE).gpd

uninstall :
$(INSTALL) -U $(GAUCHE_PKGINCDIR) $(HEADERS)
$(INSTALL) -U $(GAUCHE_PKGLIBDIR) $(SCMFILES)
$(INSTALL) -U $(GAUCHE_PKGARCHDIR) $(ARCHFILES)
$(INSTALL) -U $(GAUCHE_PKGLIBDIR)/.packages $(PACKAGE).gpd

clean :
$(GAUCHE_PACKAGE) compile --clean gauche_vim_xire $(gauche_vim_xire_SRCS)
rm -rf core $(TARGET) $(GENERATED) *~ test.log so_locations

distclean : clean
rm -rf $(CONFIG_GENERATED)

maintainer-clean : clean
rm -rf $(CONFIG_GENERATED) configure VERSION

73 changes: 73 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
dnl
dnl Configuring gauche-vim-xire
dnl process this file with autoconf to generate 'configure'.
dnl $Id: template.configure.ac,v 1.4 2008-04-18 12:36:26 shirok Exp $
dnl

AC_PREREQ(2.54)
AC_INIT(gauche-vim-xire, 1.0, shiro@acm.org)
dnl If you want to use the system name (OS, architecture, etc) in the
dnl configure, uncomment the following line. In such a case, you need
dnl to copy config.guess and config.sub from automake distribution.
dnl AC_CANONICAL_SYSTEM

dnl Replace @LOCAL_PATHS@ by --with-local option.
AC_ARG_WITH(local,
AC_HELP_STRING([--with-local=PATH:PATH...],
[For each PATH, add PATH/include to the include search
paths and PATH/lib to the library search paths. Useful if you have some
libraries installed in non-standard places. ]),
[
case $with_local in
yes|no|"") ;; #no effect
*) LOCAL_PATHS=$with_local ;;
esac
])
AC_SUBST(LOCAL_PATHS)

dnl Set up gauche related commands. The commands are set by scanning
dnl PATH. You can override them by "GOSH=/my/gosh ./configure" etc.
AC_PATH_PROG([GOSH], gosh)
AC_PATH_PROG([GAUCHE_CONFIG], gauche-config)
AC_PATH_PROG([GAUCHE_PACKAGE], gauche-package)
AC_PATH_PROG([GAUCHE_INSTALL], gauche-install)
AC_PATH_PROG([GAUCHE_CESCONV], gauche-cesconv)

dnl Usually these parameters are set by AC_PROG_CC, but we'd rather use
dnl the same one as Gauche has been compiled with.
SOEXT=`$GAUCHE_CONFIG --so-suffix`
OBJEXT=`$GAUCHE_CONFIG --object-suffix`
EXEEXT=`$GAUCHE_CONFIG --executable-suffix`
AC_SUBST(SOEXT)
AC_SUBST(OBJEXT)
AC_SUBST(EXEEXT)

ac_default_prefix=`$GAUCHE_CONFIG --prefix`

GAUCHE_PKGINCDIR=`$GAUCHE_CONFIG --pkgincdir`
GAUCHE_PKGLIBDIR=`$GAUCHE_CONFIG --pkglibdir`
GAUCHE_PKGARCHDIR=`$GAUCHE_CONFIG --pkgarchdir`
AC_SUBST(GAUCHE_PKGINCDIR)
AC_SUBST(GAUCHE_PKGLIBDIR)
AC_SUBST(GAUCHE_PKGARCHDIR)

dnl Check for headers.
dnl Add your macro calls to check required headers, if you have any.

dnl Check for other programs.
dnl Add your macro calls to check existence of programs, if you have any.

dnl Check for libraries
dnl Add your macro calls to check required libraries, if you have any.

dnl Creating gpd (gauche package description) file
GAUCHE_PACKAGE_CONFIGURE_ARGS="`echo ""$ac_configure_args"" | sed 's/[\\""\`\$]/\\\&/g'`"
AC_MSG_NOTICE([creating ${PACKAGE_NAME}.gpd])
$GAUCHE_PACKAGE make-gpd "$PACKAGE_NAME" \
-version "$PACKAGE_VERSION" \
-configure "./configure $GAUCHE_PACKAGE_CONFIGURE_ARGS"

dnl Output
echo $PACKAGE_VERSION > VERSION
AC_OUTPUT(Makefile)

34 changes: 34 additions & 0 deletions gauche_vim_xire.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* gauche_vim_xire.c
*/

#include "gauche_vim_xire.h"

/*
* The following function is a dummy one; replace it for
* your C function definitions.
*/

ScmObj test_gauche_vim_xire(void)
{
return SCM_MAKE_STR("gauche_vim_xire is working");
}

/*
* Module initialization function.
*/
extern void Scm_Init_gauche_vim_xirelib(ScmModule*);

void Scm_Init_gauche_vim_xire(void)
{
ScmModule *mod;

/* Register this DSO to Gauche */
SCM_INIT_EXTENSION(gauche_vim_xire);

/* Create the module if it doesn't exist yet. */
mod = SCM_MODULE(SCM_FIND_MODULE("vim.xire", TRUE));

/* Register stub-generated procedures */
Scm_Init_gauche_vim_xirelib(mod);
}
24 changes: 24 additions & 0 deletions gauche_vim_xire.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* gauche_vim_xire.h
*/

/* Prologue */
#ifndef GAUCHE_GAUCHE_VIM_XIRE_H
#define GAUCHE_GAUCHE_VIM_XIRE_H

#include <gauche.h>
#include <gauche/extend.h>

SCM_DECL_BEGIN

/*
* The following entry is a dummy one.
* Replace it for your declarations.
*/

extern ScmObj test_gauche_vim_xire(void);

/* Epilogue */
SCM_DECL_END

#endif /* GAUCHE_GAUCHE_VIM_XIRE_H */
18 changes: 18 additions & 0 deletions gauche_vim_xirelib.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
;;;
;;; gauche_vim_xirelib.stub
;;;

"
#include \"gauche_vim_xire.h\"
"

;; The following entry is a dummy one.
;; Replace it for your definitions.

(define-cproc test-gauche_vim_xire () ::<const-cstring>
(result "gauche_vim_xire is working"))


;; Local variables:
;; mode: scheme
;; end:
22 changes: 22 additions & 0 deletions test.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
;;;
;;; Test vim.xire
;;;

(use gauche.test)

(test-start "vim.xire")
(use vim.xire)
(test-module 'vim.xire)

;; The following is a dummy test code.
;; Replace it for your tests.
(test* "test-gauche_vim_xire" "gauche_vim_xire is working"
(test-gauche_vim_xire))

;; epilogue
(test-end)





21 changes: 21 additions & 0 deletions vim/xire.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
;;;
;;; gauche_vim_xire
;;;

(define-module vim.xire
(export test-gauche_vim_xire ;; dummy
)
)
(select-module vim.xire)

;; Loads extension
(dynamic-load "gauche_vim_xire")

;;
;; Put your Scheme definitions here
;;

;; Epilogue
(provide "vim/xire")


0 comments on commit b0fe145

Please sign in to comment.