cake
/
libg1m
Archived
1
0
Fork 0

Stupid bug, modernized configure script

This commit is contained in:
Thomas Touhey 2016-11-23 08:23:29 +01:00
parent 2febe9ae2c
commit bfac9ee1dc
2 changed files with 65 additions and 33 deletions

96
configure vendored
View File

@ -1,27 +1,41 @@
#!/bin/sh
# Defaults
name="$(make -sC $(dirname $0) getname)"
author="$(make -sC $(dirname $0) getauthor)"
complete_author="$author <$(make -sC $(dirname $0) getmail)>"
version="$(make -sC $(dirname $0) getversion)"
# - Platform
cd "$(dirname $0)"
#******************************************************************************#
# Defaults #
#******************************************************************************#
# Project variables
name="$(make -s getname)"
version="$(make -s getversion)"
# Author
author_name="$(make -s getauthor)"
author="$author_name <$(make -s getmail)>"
# Platform
platform="$(gcc --print-multiarch)"
platform="$([ "$platform" ] && echo "/$platform")"
# - Basic things
# Make options
make_full_log=
# Build options
loglevel=none # none, info, warn, error, fatal
# Installation directories
root=''
# - main things
prefix='${root}/usr'
bindir='${prefix}/bin'
libdir='${prefix}/lib'"$platform"
includedir='${prefix}/include'"$platform"
mandir='${prefix}/share/man'
# - misc
# Installation options
install_manpages=yes
install_devel=yes
# Help
#******************************************************************************#
# Help message #
#******************************************************************************#
usage() {
cat <<EOF
\`configure\` configures ${name} to adapt to systems that aren't mine.
@ -51,16 +65,18 @@ Fine tuning of the installation directories:
--includedir=DIR include files for the compiler [$includedir]
--mandir=DIR man root [$mandir]
Report bugs to ${complete_author}.
Report bugs to ${author}.
EOF
exit 0
}
# Version
#******************************************************************************#
# Version message #
#******************************************************************************#
version() {
cat <<EOF
${name} configure script v${version}
Hand-written by ${author}.
Hand-written by ${author_name}.
This configure script is free software.
There is NO warranty; not even for MERCHANTABILITY or
@ -69,18 +85,21 @@ EOF
exit 0
}
# Args parsing
# - check for help and version
#******************************************************************************#
# Check for help and version #
#******************************************************************************#
put_version=
put_help=
for arg ; do case "$arg" in
--help|-h) put_help=1 ;;
--version|-v) put_version=1 ;;
esac; done
if [ $put_version ]; then version; fi
if [ $put_help ]; then usage; fi
[ $put_version ] && version
[ $put_help ] && usage
# - get options
#******************************************************************************#
# Parse arguments #
#******************************************************************************#
for arg ; do case "$arg" in
--make-full-log) make_full_log=yes ;;
--loglevel=*)
@ -107,34 +126,47 @@ got '$level'"
*) echo "$arg: didn't read" ;;
esac; done
# Evaluate
#******************************************************************************#
# Evaluate variables #
#******************************************************************************#
for var in prefix sysconfdir bindir libdir includedir mandir udevrulesdir; do
eval $var'='$(eval 'echo $'$var)
done
# Create Makefile configuration
exec 3>&1 1>"$(dirname $0)/Makefile.cfg"
#******************************************************************************#
# Create Makefile configuration #
#******************************************************************************#
exec 3>&1 1>Makefile.cfg
cat <<EOF
#!/usr/bin/make -f
# Makefile configuration generated by ./configure
# - Configuration version
#******************************************************************************#
# Makefile configuration generated by ./configure #
#******************************************************************************#
# Configuration version and messages configuration
CONFIG_VERSION = $version
MAKE_FULL_LOG = $make_full_log
# - Build options
# Build options
LOG_LEVEL = $loglevel
# - Install options
INSTALL_MANPAGES = $install_manpages
INSTALL_DEVEL = $install_devel
# - Install prefix and directories
# Installation directories
IBINDIR = $bindir
ILIBDIR = $libdir
IINCDIR = $includedir
IMANDIR = $mandir
# Installation options
INSTALL_MANPAGES = $install_manpages
INSTALL_DEVEL = $install_devel
# End of file.
EOF
exec 1>&3 3>&-
chmod +x "$(dirname $0)/Makefile.cfg"
chmod +x Makefile.cfg
# We're done
#******************************************************************************#
# Finish #
#******************************************************************************#
echo "Configuration loaded, you can make now."
# End of file.

View File

@ -40,7 +40,7 @@ size_t g1m_mbstofcs(FONTCHARACTER *dest, const char *src, size_t n)
len++;
n -= count;
}
*dst = 0;
*dest = 0;
return (len);
}