Multi-arch support, bump Standards-Version, and debian/compat
* Introduce multi-arch support which allows one to use datefudge with 32-bit
commands on 64-bit system (providing that both 32-bit and 64-bit versions
of this package are installed on system) (LP: #1103281):
+ install datefudge.so library into /usr/lib/datefudge/<arch-tripplet>;
+ add each /u/l/d/<arch-tripplet> to LD_LIBRARY_PATH in datefudge scipt;
+ mark binary package as `Multi-Arch: same'.
* Use debhelper v9.
* debian/control:
+ Standards-Version: 3.9.4 (no changes).
Robert Luberda
11 years ago
8 | 8 | INSTALL_PROGRAM := "install" |
9 | 9 | endif |
10 | 10 | |
11 | compile all: datefudge datefudge.so | |
11 | prefix = /usr | |
12 | libdir = $(prefix)/lib/datefudge | |
13 | libarch = | |
14 | marchpt = $(shell echo '$(libarch)' | sed -e 's|[^-]|*|g; s|\*\**|*|g; s|^.|/&|') | |
15 | bindir = $(prefix)/bin | |
16 | mandir = $(prefix)/share/man | |
17 | ||
18 | all compile: datefudge datefudge.so datefudge.1 | |
12 | 19 | |
13 | 20 | install: datefudge datefudge.so datefudge.1 |
14 | install -d $(DESTDIR)/usr/lib/datefudge/ | |
15 | $(INSTALL_PROGRAM) -o root -g root -m 644 datefudge.so $(DESTDIR)/usr/lib/datefudge/datefudge.so | |
16 | install -d $(DESTDIR)/usr/bin/ | |
17 | $(INSTALL_PROGRAM) -o root -g root -m 755 datefudge $(DESTDIR)/usr/bin | |
18 | install -d $(DESTDIR)/usr/share/man/man1 | |
19 | install -o root -g root -m 644 datefudge.1 $(DESTDIR)/usr/share/man/man1 | |
21 | install -d $(DESTDIR)$(libdir)/$(libarch) | |
22 | $(INSTALL_PROGRAM) -o root -g root -m 644 datefudge.so $(DESTDIR)$(libdir)/$(libarch)/datefudge.so | |
23 | install -d $(DESTDIR)$(bindir) | |
24 | $(INSTALL_PROGRAM) -o root -g root -m 755 datefudge $(DESTDIR)$(bindir) | |
25 | install -d $(DESTDIR)$(mandir)/man1 | |
26 | install -o root -g root -m 644 datefudge.1 $(DESTDIR)$(mandir)/man1 | |
20 | 27 | |
21 | 28 | datefudge: datefudge.sh |
22 | sed -e 's,@VERSION@,$(VERSION),g' < $< > $@ | |
29 | datefudge.1: datefudge.man | |
30 | ||
31 | datefudge datefudge.1: | |
32 | sed -e 's,@VERSION@,$(VERSION),g; s,@MULTIARCH_PATTERN@,$(marchpt),g; s,@LIBDIR@,$(libdir),g;' \ | |
33 | < $< > $@ | |
23 | 34 | |
24 | 35 | datefudge.so: datefudge.o |
25 | 36 | $(CC) $(LDFLAGS) -o $@ -shared $< -ldl -lc |
26 | 37 | |
27 | 38 | datefudge.o: datefudge.c |
28 | 39 | $(CC) $(CFLAGS) -c -o $@ $< |
29 | ||
30 | datefudge.1: datefudge.man | |
31 | sed -e 's,@VERSION@,$(VERSION),g' < $< > $@ | |
32 | 40 | |
33 | 41 | clean: |
34 | 42 | rm -f datefudge.o datefudge.so datefudge datefudge.1 |
0 | 0 | #!/bin/sh |
1 | ||
1 | # vim:noet:ts=2 | |
2 | 2 | # Fake the system time |
3 | ||
4 | 3 | |
5 | 4 | dat="$1" |
6 | 5 | static=0 |
7 | ||
8 | 6 | |
9 | 7 | if [ "$dat" = "-s" -o "$dat" = "--static" ] ; then |
10 | 8 | static=1 |
29 | 27 | |
30 | 28 | # Assume that 'date' already printed an error message |
31 | 29 | sec1=$(date -d "$dat" '+%s') |
32 | if [ $? -ne 0 ] ; then exit 1 ; fi | |
30 | [ $? -eq 0 ] || exit 1 | |
33 | 31 | |
34 | 32 | sec2=$(expr $(date '+%s') - $sec1) |
35 | if [ $? -ne 0 ] ; then exit 1 ; fi | |
33 | [ $? -eq 0 ] || exit 1 | |
36 | 34 | |
37 | export LD_PRELOAD="${LD_PRELOAD}${LD_PRELOAD:+:}/usr/lib/datefudge/datefudge.so" | |
38 | if [ "$static" = "1" ]; then | |
39 | export DATEFUDGE=$sec1 | |
40 | export DATEFUDGE_DOSTATIC="1" | |
41 | else | |
42 | export DATEFUDGE=$sec2 | |
43 | unset DATEFUDGE_DOSTATIC | |
44 | fi | |
35 | add_ld_preload() | |
36 | { | |
37 | export LD_PRELOAD="${1}${LD_PRELOAD:+:}${LD_PRELOAD}" | |
38 | } | |
39 | ||
40 | add_ld_library_path() | |
41 | { | |
42 | export LD_LIBRARY_PATH="${1}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" | |
43 | } | |
44 | ||
45 | set_ld_environment() | |
46 | { | |
47 | lib="datefudge.so" | |
48 | libpath="@LIBDIR@" | |
49 | set -- "$libpath"@MULTIARCH_PATTERN@/"$lib" | |
50 | if [ ! -e "$1" ]; then | |
51 | echo "Cannot find $lib in $libpath" >&2 | |
52 | [ -z "$POSH_VERSION" ] || echo "You might have just encountered posh bug#636601, please try using another shell." >&2 | |
53 | exit 1; | |
54 | fi | |
55 | for path in "$@"; do | |
56 | add_ld_library_path "${path%/*}" | |
57 | done | |
58 | add_ld_preload "$lib" | |
59 | } | |
60 | ||
61 | set_datefudge_vars() | |
62 | { | |
63 | if [ "$static" = "1" ]; then | |
64 | export DATEFUDGE=$sec1 | |
65 | export DATEFUDGE_DOSTATIC="1" | |
66 | else | |
67 | export DATEFUDGE=$sec2 | |
68 | unset DATEFUDGE_DOSTATIC | |
69 | fi | |
70 | } | |
71 | ||
72 | ||
73 | set_ld_environment | |
74 | set_datefudge_vars | |
45 | 75 | |
46 | 76 | exec "$@" |
0 | datefudge (1.18) unstable; urgency=low | |
1 | ||
2 | * Introduce multi-arch support which allows one to use datefudge with 32-bit | |
3 | commands on 64-bit system (providing that both 32-bit and 64-bit versions | |
4 | of this package are installed on system) (LP: #1103281): | |
5 | + install datefudge.so library into /usr/lib/datefudge/<arch-tripplet>; | |
6 | + add each /u/l/d/<arch-tripplet> to LD_LIBRARY_PATH in datefudge scipt; | |
7 | + mark binary package as `Multi-Arch: same'. | |
8 | * Use debhelper v9. | |
9 | * debian/control: | |
10 | + fix Vcs-Browser field; | |
11 | + Standards-Version: 3.9.4 (no changes). | |
12 | ||
13 | -- Robert Luberda <robert@debian.org> Sat, 11 May 2013 19:02:11 +0200 | |
14 | ||
0 | 15 | datefudge (1.17) unstable; urgency=low |
1 | 16 | |
2 | 17 | * datefudge.{c,man}: Add the `--static' option for static dates. |
1 | 1 | Section: devel |
2 | 2 | Priority: optional |
3 | 3 | Maintainer: Robert Luberda <robert@debian.org> |
4 | Standards-Version: 3.9.2 | |
5 | Build-Depends: debhelper (>= 8) | |
4 | Standards-Version: 3.9.4 | |
5 | Build-Depends: debhelper (>= 9) | |
6 | 6 | Vcs-Git: git://anonscm.debian.org/users/robert/datefudge.git |
7 | 7 | Vcs-Browser: http://anonscm.debian.org/gitweb/?p=users/robert/datefudge.git;a=summary |
8 | 8 | |
9 | 9 | Package: datefudge |
10 | 10 | Architecture: any |
11 | 11 | Depends: ${shlibs:Depends}, ${misc:Depends} |
12 | Pre-Depends: ${misc:Pre-Depends} | |
13 | Multi-Arch: same | |
12 | 14 | Description: Fake the system date |
13 | 15 | This program (and preload library) fakes the system date so that |
14 | 16 | programs think the wall clock is ... different. |
0 | 0 | #!/usr/bin/make -f |
1 | # $Id: rules 17 2011-02-13 12:29:49Z robert $ | |
2 | 1 | |
3 | 2 | export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) |
4 | 3 | export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) |
5 | 4 | |
5 | export libarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) | |
6 | ||
6 | 7 | binary binary-arch build build-arch clean: |
7 | 8 | dh $@ |
8 | 9 | |
10 | ||
9 | 11 | binary-indep build-indep: # Nothing to do |
12 | ||
13 | override_dh_auto_build: | |
14 | dh_auto_build -- libarch="$(libarch)" | |
15 | ||
16 | override_dh_auto_install: | |
17 | dh_auto_install -- libarch="$(libarch)" | |
18 | ||
10 | 19 | |
11 | 20 | .PHONY: clean \ |
12 | 21 | build-indep build-arch build \ |
13 | binary-indep binary-arch binary | |
22 | binary-indep binary-arch binary \ | |
23 | override_dh_auto_build override_dh_auto_install |