-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Geoff Levand <[email protected]>
- Loading branch information
Showing
4 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
AUTOMAKE_OPTIONS = foreign | ||
|
||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
edit = sed \ | ||
-e 's|@PACKAGE\@|$(PACKAGE)|g' \ | ||
-e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \ | ||
-e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \ | ||
-e 's|@PACKAGE_URL\@|$(PACKAGE_URL)|g' \ | ||
-e 's|@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|g' \ | ||
-e 's|@datadir\@|$(pkgdatadir)|g' \ | ||
-e 's|@libexecdir\@|$(libexecdir)|g' \ | ||
-e 's|@prefix\@|$(prefix)|g' | ||
|
||
composed_bin_scripts = scripts/start-qemu.sh | ||
|
||
bin_SCRIPTS = $(composed_bin_scripts) | ||
|
||
composed_nobase_bin_scripts = tdd-lib/util.sh | ||
|
||
nobase_bin_SCRIPTS = $(composed_nobase_bin_scripts) | ||
|
||
$(composed_bin_scripts): % : Makefile $(srcdir)/%.in | ||
rm -f '$(@)' '$(@).tmp' | ||
mkdir -p '$(@D)' | ||
$(edit) '$(srcdir)/$(@).in' > '$(@).tmp' | ||
chmod +x '$(@).tmp' | ||
mv '$(@).tmp' '$(@)' | ||
|
||
$(composed_nobase_bin_scripts): % : Makefile $(srcdir)/scripts/% | ||
rm -f '$(@)' '$(@).tmp' | ||
mkdir -p '$(@D)' | ||
$(edit) '$(srcdir)/scripts/$(@)' > '$(@).tmp' | ||
chmod +x '$(@).tmp' | ||
mv '$(@).tmp' '$(@)' | ||
|
||
# mkdir -p '$(@D)' | ||
# cp -av '$(srcdir)/scripts/$(@)' '$(@)' | ||
|
||
EXTRA_DIST = bootstrap configure.ac COPYING m4 mit-plus-license.txt README.md \ | ||
tests/* version.sh $(addsuffix .in, $(composed_bin_scripts)) \ | ||
$(nobase_bin_SCRIPTS) | ||
|
||
CLEANFILES = $(bin_SCRIPTS) | ||
|
||
MAINTAINERCLEANFILES = aclocal.m4 compile config.h* configure depcomp \ | ||
install-sh Makefile.in missing $(PACKAGE)-*.gz | ||
|
||
maintainer-clean-local: | ||
rm -rf m4 .deps | ||
|
||
.PHONY: help | ||
|
||
help: | ||
@echo "Targets:" | ||
@echo " make install" | ||
@echo " make dist" | ||
@echo " make distcheck" | ||
@echo " make distclean" | ||
@echo " make maintainer-clean" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
script_name="${0##*/}" | ||
|
||
echo "${script_name}: '$(pwd)'" | ||
|
||
progs="bash" | ||
for p in ${progs}; do | ||
if ! test -x "$(command -v ${p})"; then | ||
echo "${script_name}: ERROR: Please install '${p}'." >&2 | ||
result=1 | ||
fi | ||
done | ||
|
||
if [[ ${result} ]]; then | ||
exit 1 | ||
fi | ||
|
||
mkdir -p m4 | ||
exec autoreconf --force --install ${@} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## configure.ac -- Process this file with autoconf to produce configure | ||
|
||
AC_INIT([tdd-project], | ||
[m4_esyscmd_s([./version.sh])], | ||
[Geoff Levand <[email protected]>], | ||
[tdd-project], | ||
[https://github.com/glevand/tdd-project]) | ||
|
||
AC_USE_SYSTEM_EXTENSIONS | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
AC_PREFIX_DEFAULT([/usr/local]) | ||
AC_PROG_INSTALL | ||
|
||
AM_INIT_AUTOMAKE | ||
AC_GNU_SOURCE | ||
|
||
AM_SILENT_RULES([yes]) | ||
|
||
AC_SUBST([DESTDIR]) | ||
AC_CONFIG_HEADERS([config.h]) | ||
AC_CONFIG_FILES([Makefile]) | ||
|
||
AC_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# version.sh: Create a version string for use by configure.ac | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
version= | ||
datefmt='%Y.%m.%d' | ||
|
||
GIT_DIR=$(dirname "${0}")/.git/ | ||
export GIT_DIR | ||
|
||
if head="$(git rev-parse --short=8 --verify HEAD 2>/dev/null)"; then | ||
suffix='' | ||
# Add a '-dirty' suffix for uncommitted changes. | ||
if git diff-index HEAD | read -r dummy; then | ||
suffix='-dirty' | ||
fi | ||
|
||
if tag="$(git describe --tags --exact-match 2>/dev/null)"; then | ||
# use a tag; remove any 'v' prefix from v<VERSION> tags | ||
tag="${tag#v}" | ||
version="$(printf "%s%s" "${tag}" "${suffix}")" | ||
else | ||
# Use the git commit revision for the package version, and add | ||
# a date prefix for easy comparisons. | ||
date="$(git log --pretty=format:"%ct" -1 HEAD)" | ||
version="$(printf "%($datefmt)T.g%s%s" "${date}" "${head}" "${suffix}")" | ||
fi | ||
else | ||
# Check if a specific version is set, eg: by buildroot | ||
if [ -n "${PACKAGE_VERSION}" ]; then | ||
# Full git hash | ||
len="$(echo -n "${PACKAGE_VERSION}" | wc -c)" | ||
if [[ ${len} == 40 ]]; then | ||
version="$(echo -n "${PACKAGE_VERSION}" | sed 's/^\([0-9a-f]\{7\}\).*/\1/;')" | ||
else | ||
version="${PACKAGE_VERSION}" | ||
fi | ||
else | ||
# Default to current date and time. | ||
version="$(date +dev.${datefmt})" | ||
fi | ||
fi | ||
|
||
echo "${version}" |