Created
May 13, 2009 19:30
-
-
Save skriticos/111233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This was a bit toying around with bootstrapping based on autotools. | |
LIBRARY=0 | |
fn_print_help () | |
{ | |
echo "NAME" | |
echo " bootstrap - create acme programming project" | |
echo | |
echo "SYNOPSIS" | |
echo " bootstrap NAME" | |
echo | |
echo "DESCRIPTION" | |
echo " This script creates an acme project directory sturcture" | |
echo " for programming projects." | |
echo | |
echo "OPTIONS" | |
echo " -x --xlong" | |
echo " desc" | |
echo | |
echo "COPYRIGHT" | |
echo " You may redistribute this software under the terms of the " | |
echo " GNU General Public License." | |
} | |
PHRASE_PARM=`getopt -o ly:z --long library,yb:,zwhatever,help -n $0 -- "$@"` | |
eval set -- "$PHRASE_PARM" | |
while true | |
do | |
case "$1" in | |
-l|--library) LIBRARY=1; shift ;; | |
-y|--yb) SETSOMETHING; shift 2;; | |
-z|--zwhatever) SETSOMETING; shift ;; | |
--help) fn_print_help; exit 0 ;; | |
--) shift ; break ;; | |
*) echo "Internal error!" 1>&2 ; exit 1 ;; | |
esac | |
done | |
if [[ "$1" = "" ]] | |
then | |
echo "You must specify a program name!" | |
echo "Run bootstrap --help for detailed information." | |
exit 1 | |
else | |
NAME=$1 | |
fi | |
mkdir $NAME | |
cd $NAME | |
mkdir doc src | |
echo "AC_INIT" > configure.in | |
echo "AM_CONFIG_HEADER(config.h)" >> configure.in | |
echo "AM_INIT_AUTOMAKE($NAME,0.1.0)" >> configure.in | |
echo "AC_PROG_CC" >> configure.in | |
echo "AC_PROG_CXX" >> configure.in | |
echo "AC_PROG_RANLIB" >> configure.in | |
echo "AC_OUTPUT(Makefile doc/Makefile src/Makefile)" >> configure.in | |
# library creation | |
if [[ "$LIBRARY" = "1" ]] | |
then | |
echo "AC_PROG_LIBTOOL" >> configure.in | |
fi | |
touch COPYING AUTHORS NEWS README ChangeLog | |
echo "#! /bin/sh" > reconf | |
echo "rm -f config.cache" >> reconf | |
echo "rm -f acconfig.h" >> reconf | |
echo "aclocal" >> reconf | |
echo "autoconf" >> reconf | |
# echo "acconfig" >> reconf | |
echo "autoheader" >> reconf | |
echo "automake -a" >> reconf | |
chmod 755 reconf | |
touch Makefile.am doc/Makefile.am src/Makefile.am | |
echo "EXTRA_DIST = reconf configure" >> Makefile.am | |
echo "SUBDIRS = doc src" >> Makefile.am | |
echo "" >> Makefile.am | |
echo "bin_PROGRAMS = $NAME" >> src/Makefile.am | |
echo "${NAME}_SOURCES = ${NAME}.c" >> src/Makefile.am | |
# This needs testing and modification for dynamic libraries (these are | |
# static). | |
if [[ "$LIBRARY" = "1" ]] | |
then | |
echo "include_HEADERS = $NAME.h" >> src/Makefile | |
echo "lib_LTLIBRARIES = $NAME.la" >> src/Makefile | |
echo "libshell_la_SOURCES = $NAME.c" >> src/Makefile | |
fi | |
echo "#if HAVE_CONFIG_H" >> src/${NAME}.c | |
echo "# include <config.h>" >> src/${NAME}.c | |
echo "#endif" >> src/${NAME}.c | |
echo "#include <stdio.h>" >> src/${NAME}.c | |
echo "" >> src/${NAME}.c | |
echo "int main (int argc, char *argv[])" >> src/${NAME}.c | |
echo "{" >> src/${NAME}.c | |
echo " return 0;" >> src/${NAME}.c | |
echo "}" >> src/${NAME}.c | |
./reconf | |
./configure | |
cd .. | |
svnadmin create ~/depot/$NAME | |
svn import ./$NAME file:///home/$USER/depot/$NAME -m "Initial import." | |
rm -r $NAME/* | |
svn co file:///home/$USER/depot/$NAME ./$NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment