Use new `paths' system

This commit is contained in:
Laurence Withers 2007-09-11 22:06:23 +00:00
parent f1b6e09453
commit ec8bcba829
21 changed files with 132 additions and 65 deletions

View File

@ -1,11 +1,11 @@
build_target @NAME@ build_target @NAME@
# make paths (this is for Gentoo in particular) # make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1 build_dir_tree "${@DEST_BINDIR@}" || return 1
# install binary # install binary
echo "Installing binaries into '${BINDIR}'" echo "Installing binaries into '${@DEST_BINDIR@}'"
install_file "${@CNAME@}" "${BINDIR}" 0755 || return 1 install_file "${@CNAME@}" "${@DEST_BINDIR@}" 0755 || return 1
print_success "Done" print_success "Done"
# kate: @KATE_MODELINE@ # kate: @KATE_MODELINE@

View File

@ -1,14 +1,17 @@
if [ $# -ne 0 ] case "$1" in
then bin) DEST_BINDIR="BINDIR" ;;
print_failure "Too many arguments. None required for this module." sbin) DEST_BINDIR="SBINDIR" ;;
cgi) DEST_BINDIR="CGIDIR" ;;
**)
echo "One argument required: binary location (bin, sbin or cgi)."
exit 1 exit 1
;;
fi fi
do_parameter_subst do_parameter_subst DEST_BINDIR
add_config_option "CXX" "${COPT_CXX_DEFAULT}" add_config_option "CXX" "${COPT_CXX_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "QTSTUFF" "${COPT_QTSTUFF_DEFAULT}" add_config_option "QTSTUFF" "${COPT_QTSTUFF_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,11 +1,11 @@
build_target @NAME@ build_target @NAME@
# make paths (this is for Gentoo in particular) # make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1 build_dir_tree "${@DEST_BINDIR@}" || return 1
# install binary # install binary
echo "Installing binaries into '${BINDIR}'" echo "Installing binaries into '${@DEST_BINDIR@}'"
install_file "${@CNAME@}" "${BINDIR}" 0755 || return 1 install_file "${@CNAME@}" "${@DEST_BINDIR@}" 0755 || return 1
print_success "Done" print_success "Done"
# kate: @KATE_MODELINE@ # kate: @KATE_MODELINE@

View File

@ -1,13 +1,16 @@
if [ $# -ne 0 ] case "$1" in
then bin) DEST_BINDIR="BINDIR" ;;
print_failure "Too many arguments. None required for this module." sbin) DEST_BINDIR="SBINDIR" ;;
cgi) DEST_BINDIR="CGIDIR" ;;
**)
echo "One argument required: binary location (bin, sbin or cgi)."
exit 1 exit 1
;;
fi fi
do_parameter_subst do_parameter_subst DEST_BINDIR
add_config_option "CXX" "${COPT_CXX_DEFAULT}" add_config_option "CXX" "${COPT_CXX_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,11 +1,11 @@
build_target @NAME@ build_target @NAME@
# make paths (this is for Gentoo in particular) # make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1 build_dir_tree "${@DEST_BINDIR@}" || return 1
# install binary # install binary
echo "Installing binaries into '${BINDIR}'" echo "Installing binaries into '${@DEST_BINDIR@}'"
install_file "${@CNAME@}" "${BINDIR}" 0755 || return 1 install_file "${@CNAME@}" "${@DEST_BINDIR@}" 0755 || return 1
print_success "Done" print_success "Done"
# kate: @KATE_MODELINE@ # kate: @KATE_MODELINE@

View File

@ -1,13 +1,16 @@
if [ $# -ne 0 ] case "$1" in
then bin) DEST_BINDIR="BINDIR" ;;
print_failure "Too many arguments. None required for this module." sbin) DEST_BINDIR="SBINDIR" ;;
cgi) DEST_BINDIR="CGIDIR" ;;
**)
echo "One argument required: binary location (bin, sbin or cgi)."
exit 1 exit 1
;;
fi fi
do_parameter_subst do_parameter_subst DEST_BINDIR
add_config_option "CC" "${COPT_CC_DEFAULT}" add_config_option "CC" "${COPT_CC_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,11 +1,11 @@
# make paths (this is for Gentoo in particular) # make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1 build_dir_tree "${@DEST_BINDIR@}" || return 1
# install binary # install binary
echo "Installing binaries into '${BINDIR}'" echo "Installing binaries into '${@DEST_BINDIR@}'"
for script in src/@NAME@/*.sh for script in src/@NAME@/*.sh
do do
install_file "${script}" "${BINDIR}" 0755 || return 1 install_file "${script}" "${@DEST_BINDIR@}" 0755 || return 1
done done
print_success "Done" print_success "Done"

View File

@ -1,11 +1,14 @@
if [ $# -ne 0 ] case "$1" in
then bin) DEST_BINDIR="BINDIR" ;;
print_failure "Too many arguments. None required for this module." sbin) DEST_BINDIR="SBINDIR" ;;
cgi) DEST_BINDIR="CGIDIR" ;;
**)
echo "One argument required: binary location (bin, sbin or cgi)."
exit 1 exit 1
;;
fi fi
do_parameter_subst do_parameter_subst DEST_BINDIR
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -5,7 +5,6 @@ then
fi fi
do_parameter_subst do_parameter_subst
add_config_option "DOCSDIR" "${COPT_DOCSDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -5,7 +5,6 @@ then
fi fi
do_parameter_subst do_parameter_subst
add_config_option "DOCSDIR" "${COPT_DOCSDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -5,7 +5,7 @@ then
fi fi
do_parameter_subst do_parameter_subst
add_config_option "HEXDIR" "${COPT_HEXDIR_DEFAULT}" add_config_option "HEXDIR" "\${SHAREDIR}/@TODO@"
add_config_option "GPASM" "gpasm" add_config_option "GPASM" "gpasm"
add_config_option "GPASM_FLAGS" "" add_config_option "GPASM_FLAGS" ""
true true

View File

@ -5,7 +5,7 @@ then
fi fi
do_parameter_subst do_parameter_subst
add_config_option "HEXDIR" "${COPT_HEXDIR_DEFAULT}" add_config_option "HEXDIR" "\${SHAREDIR}/@TODO@"
add_config_option "SDCC" "sdcc" add_config_option "SDCC" "sdcc"
add_config_option "SDCCFLAGS" "" add_config_option "SDCCFLAGS" ""
true true

View File

@ -27,8 +27,8 @@ CONFFILE="${INSTALL_PREFIX}${BINDIR}/@NAME@-config"
do_cmd rm -f "${CONFFILE}" do_cmd rm -f "${CONFFILE}"
do_cmd_redir "${CONFFILE}" sed \ do_cmd_redir "${CONFFILE}" sed \
-e "s,@VERSION@,${VERSION}," \ -e "s,@VERSION@,${VERSION}," \
-e "s,@LIB_DIR@,${FINALLIBDIR}," \ -e "s,@LIB_DIR@,${LIBDIR}," \
-e "s,@INCLUDE_DIR@,${FINALINCLUDEDIR}," \ -e "s,@INCLUDE_DIR@,${INCLUDEDIR}," \
-e "s,@DEP_CFLAGS@,${@CNAME@_DEP_CFLAGS}," \ -e "s,@DEP_CFLAGS@,${@CNAME@_DEP_CFLAGS}," \
-e "s,@DEP_LIBS@,${@CNAME@_DEP_LIBS}," \ -e "s,@DEP_LIBS@,${@CNAME@_DEP_LIBS}," \
src/@NAME@/config-script src/@NAME@/config-script

View File

@ -20,11 +20,6 @@ fi
do_parameter_subst NAMEMINUSL HEADER_NAME do_parameter_subst NAMEMINUSL HEADER_NAME
add_config_option "CC" "${COPT_CC_DEFAULT}" add_config_option "CC" "${COPT_CC_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
add_config_option "LIBDIR" "${COPT_LIBDIR_DEFAULT}"
add_config_option "INCLUDEDIR" "${COPT_INCLUDEDIR_DEFAULT}"
add_config_option "FINALLIBDIR" "${COPT_FINALLIBDIR_DEFAULT}"
add_config_option "FINALINCLUDEDIR" "${COPT_FINALINCLUDEDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -29,8 +29,8 @@ do_cmd_redir "${CONFFILE}" sed \
-e "s,@VERSION@,${VERSION}," \ -e "s,@VERSION@,${VERSION}," \
-e "s,@DEP_CFLAGS@,${@CNAME@_DEP_CFLAGS}," \ -e "s,@DEP_CFLAGS@,${@CNAME@_DEP_CFLAGS}," \
-e "s,@DEP_LIBS@,${@CNAME@_DEP_LIBS}," \ -e "s,@DEP_LIBS@,${@CNAME@_DEP_LIBS}," \
-e "s,@LIB_DIR@,${FINALLIBDIR}," \ -e "s,@LIB_DIR@,${LIBDIR}," \
-e "s,@INCLUDE_DIR@,${FINALINCLUDEDIR}," \ -e "s,@INCLUDE_DIR@,${INCLUDEDIR}," \
src/@NAME@/config-script src/@NAME@/config-script
do_cmd chmod 0755 "${CONFFILE}" do_cmd chmod 0755 "${CONFFILE}"

View File

@ -20,11 +20,6 @@ fi
do_parameter_subst NAMEMINUSL HEADER_NAME do_parameter_subst NAMEMINUSL HEADER_NAME
add_config_option "CC" "${COPT_CC_DEFAULT}" add_config_option "CC" "${COPT_CC_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
add_config_option "LIBDIR" "${COPT_LIBDIR_DEFAULT}"
add_config_option "INCLUDEDIR" "${COPT_INCLUDEDIR_DEFAULT}"
add_config_option "FINALLIBDIR" "${COPT_FINALLIBDIR_DEFAULT}"
add_config_option "FINALINCLUDEDIR" "${COPT_FINALINCLUDEDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -7,11 +7,6 @@ fi
do_parameter_subst do_parameter_subst
add_config_option "CC" "${COPT_CC_DEFAULT}" add_config_option "CC" "${COPT_CC_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}"
add_config_option "LIBDIR" "${COPT_LIBDIR_DEFAULT}"
add_config_option "INCLUDEDIR" "${COPT_INCLUDEDIR_DEFAULT}"
add_config_option "FINALLIBDIR" "${COPT_FINALLIBDIR_DEFAULT}"
add_config_option "FINALINCLUDEDIR" "${COPT_FINALINCLUDEDIR_DEFAULT}"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -7,8 +7,7 @@ fi
do_parameter_subst do_parameter_subst
add_config_option "CC" "${COPT_CC_DEFAULT}" add_config_option "CC" "${COPT_CC_DEFAULT}"
add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}" add_config_option "CFLAGS" "${COPT_CFLAGS_DEFAULT}"
add_config_option "BINDIR" "${COPT_BINDIR_DEFAULT}" add_config_option "MODULEDIR" "\${LIBDIR}/@TODO@/"
add_config_option "MODULEDIR" "${COPT_LIBDIR_DEFAULT}/@TODO@/"
true true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -83,17 +83,10 @@ add_config_option() {
# add the default line # add the default line
echo "[ -z \"\${$1}\" ] && $1=\"$2\"" >> ../../config echo "[ -z \"\${$1}\" ] && $1=\"$2\"" >> ../../config
} }
COPT_BINDIR_DEFAULT='${PREFIX}/bin'
COPT_LIBDIR_DEFAULT='${PREFIX}/lib'
COPT_HEXDIR_DEFAULT='${PREFIX}/hexdir'
COPT_INCLUDEDIR_DEFAULT='${PREFIX}/include'
COPT_FINALLIBDIR_DEFAULT='${LIBDIR}'
COPT_FINALINCLUDEDIR_DEFAULT='${INCLUDEDIR}'
COPT_CC_DEFAULT="gcc" COPT_CC_DEFAULT="gcc"
COPT_CXX_DEFAULT="g++" COPT_CXX_DEFAULT="g++"
COPT_CFLAGS_DEFAULT="-g -O2 -W -Wall" COPT_CFLAGS_DEFAULT="-g -O2 -W -Wall"
COPT_QTSTUFF_DEFAULT='-I${QTDIR}/include -L${QTDIR}/lib -lqt-mt' COPT_QTSTUFF_DEFAULT='-I${QTDIR}/include -L${QTDIR}/lib -lqt-mt'
COPT_DOCSDIR_DEFAULT="\${PREFIX}/doc/${P}"
if [ ! -e "src" ] if [ ! -e "src" ]

View File

@ -7,6 +7,28 @@
# http://www.gnu.org/copyleft/gpl.html for details. # http://www.gnu.org/copyleft/gpl.html for details.
# #
# This file contains options used to build @P@. # This file contains options used to build @P@.
#
# PREFIX is the most important option. Many other paths are derived from it, as follows:
#
# PREFIX | / | /usr | /usr/local | /opt/*
# ------------+-------------------+-------------------+-------------------+-----------------
# BINDIR | /bin | /usr/bin | /usr/local/bin | /opt/*/bin
# SBINDIR | /sbin | /usr/sbin | /usr/local/sbin | /opt/*/sbin
# LIBDIR | /lib | /usr/lib | /usr/local/lib | /opt/*/lib
# INCLUDEDIR | /usr/include | /usr/include | /usr/local/include| /opt/*/include
# CONFIGDIR | /etc | /etc | /usr/local/etc | /etc/opt/*
# VARDIR | /var | /var | /var | /var/opt/*
# SHAREDIR | /usr/share | /usr/share | /usr/local/share | /opt/*/share
# DOCSDIR | /usr/share/doc | /usr/share/doc | /usr/local/share/doc, /opt/*/doc
# WEBDIR | /srv/http | /srv/http | /srv/http | /opt/*/http
#
# Specific notes:
# When installing, all paths are prepended with INSTALL_PREFIX.
# Any parameter can be overridden by setting an environment variable.
# CGIDIR is set to ${WEBDIR}/cgi-bin .
#
[ -z "${PREFIX}" ] && PREFIX="/usr/local" [ -z "${PREFIX}" ] && PREFIX="/usr/local"
source "scripts/paths"
# Project-specific variables below.

58
skel/scripts/paths Normal file
View File

@ -0,0 +1,58 @@
# @P@/scripts/paths
# vim: syntax=sh:sw=4:ts=4:expandtab
#
# Default path setup. Not meant for editing; use environment variables
# to override values if needed.
#
case "${PREFIX}" in
/)
BINDIR="/bin"
SBINDIR="/sbin"
LIBDIR="/lib"
INCLUDEDIR="/usr/include"
CONFIGDIR="/etc"
VARDIR="/var"
SHAREDIR="/usr/share/@P@"
DOCSDIR="/usr/share/doc/@P@"
WEBDIR="/srv/http"
;;
/usr)
BINDIR="/usr/bin"
SBINDIR="/usr/sbin"
LIBDIR="/usr/lib"
INCLUDEDIR="/usr/include"
CONFIGDIR="/etc"
VARDIR="/var"
SHAREDIR="/usr/share/@P@"
DOCSDIR="/usr/share/doc/@P@"
WEBDIR="/srv/http"
;;
/usr/local)
BINDIR="/usr/local/bin"
SBINDIR="/usr/local/sbin"
LIBDIR="/usr/local/lib"
INCLUDEDIR="/usr/local/include"
CONFIGDIR="/usr/local/etc"
VARDIR="/var"
SHAREDIR="/usr/local/share/@P@"
DOCSDIR="/usr/local/share/doc/@P@"
WEBDIR="/srv/http"
;;
/opt/*)
BINDIR="${PREFIX}/bin"
SBINDIR="${PREFIX}/sbin"
LIBDIR="${PREFIX}/lib"
INCLUDEDIR="${PREFIX}/include"
CONFIGDIR="/etc${PREFIX}"
VARDIR="/var${PREFIX}"
SHAREDIR="/var${PREFIX}"
DOCSDIR="${PREFIX}/doc"
WEBDIR="${PREFIX}/http"
;;
esac
CGIDIR="${WEBDIR}/cgi-bin"