Project import
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4443e51 --- /dev/null +++ b/Makefile
@@ -0,0 +1,109 @@ +# +# Copyright (c) 2011 Nest Labs, Inc. +# All rights reserved. +# +# This document is the property of Nest. It is considered +# confidential and proprietary information. +# +# This document may not be reproduced or transmitted in any form, +# in whole or in part, without the express written permission of +# Nest. +# +# Description: +# This file is the makefile for dpkg, the Debian package management, +# system which includes random but important utilities such as +# start-stop-daemon. +# + + +include pre.mak + +PackageName := dpkg + +PackageExtension := tar.bz2 +PackageSeparator := - + +PackagePatchArgs := -p1 + +PackageArchive := $(PackageName).$(PackageExtension) +PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion) + +PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) + +LicenseSourceFile := $(PackageSourceDir)/COPYING + +CleanPaths += $(PackageLicenseFile) + +SOURCEDIRS = $(PackageSourceDir) +$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure + +all: $(PackageDefaultGoal) + +# Generate the package license contents. + +$(LicenseSourceFile): $(BuildDirectory)/source + +$(PackageLicenseFile): $(LicenseSourceFile) + $(copy-result) + +# Extract the source from the archive and apply patches, if any. + +$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) + $(expand-and-patch-package) + +# Prepare the sources. + +$(BuildDirectory)/source: | $(PackageSourceDir) + $(Verbose)touch $@ + +# Patch the sources, if necessary. + +$(BuildDirectory)/patch: $(BuildDirectory)/source + $(Verbose)touch $@ + +# Generate the package build makefile. +# Configure the source for building. + +$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory) + $(Verbose)cd $(BuildDirectory) && \ + $(CURDIR)/$(PackageSourceDir)/configure \ + CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \ + INSTALL="$(INSTALL) $(INSTALLFLAGS)" \ + --build=$(HostTuple) \ + --host=$(TargetTuple) \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --without-dselect + $(Verbose)touch $@ + +# Build the source. +# +# We have to unset MAKEFLAGS since they confuse the package build otherwise. + +$(BuildDirectory)/build: $(BuildDirectory)/configure + $(Verbose)unset MAKEFLAGS && \ + $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ + all + $(Verbose)touch $@ + +# Stage the build to a temporary installation area. +# +# We have to unset MAKEFLAGS since they confuse the package build otherwise. + +$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory) + $(Verbose)unset MAKEFLAGS && \ + $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ + DESTDIR=$(ResultDirectory) \ + install + $(Verbose)touch $@ + +.PHONY: stage +stage: $(BuildDirectory)/stage + +clean: + $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) + $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) + $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) + +include post.mak
diff --git a/dpkg.patches/dpkg-01.description b/dpkg.patches/dpkg-01.description new file mode 100644 index 0000000..de36563 --- /dev/null +++ b/dpkg.patches/dpkg-01.description
@@ -0,0 +1,2 @@ +This is to use clock_gettime() instead of gettimeofday() for start-stop-daemon. Because time-of-day can change while doing stop daemon, the timeout can happen prematurally. +In order for it to be able to compile with older kernel, manually link to -lrt if necessary.
diff --git a/dpkg.patches/dpkg-01.patch b/dpkg.patches/dpkg-01.patch new file mode 100644 index 0000000..853d68d --- /dev/null +++ b/dpkg.patches/dpkg-01.patch
@@ -0,0 +1,80 @@ +diff -aruN a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c +--- a/utils/start-stop-daemon.c 2011-10-11 22:56:12.000000000 -0700 ++++ b/utils/start-stop-daemon.c 2015-11-24 10:37:17.354279923 -0800 +@@ -79,6 +79,7 @@ + + #include <sys/types.h> + #include <sys/time.h> ++#include <time.h> + #include <sys/stat.h> + #include <sys/ioctl.h> + #include <sys/termios.h> +@@ -288,8 +289,16 @@ + static void + xgettimeofday(struct timeval *tv) + { +- if (gettimeofday(tv, NULL) != 0) ++ struct timespec tp; ++ if (clock_gettime(CLOCK_MONOTONIC, &tp)) + fatal("gettimeofday failed"); ++ ++ /* ++ * Convert from timespec to timeval ++ * We do not care about microseconds, set to 0 ++ */ ++ tv->tv_sec = tp.tv_sec; ++ tv->tv_usec = 0; + } + + static void +diff -aruN a/configure b/configure +--- a/configure 2011-10-13 22:09:45.000000000 -0700 ++++ b/configure 2015-11-24 14:33:53.319638762 -0800 +@@ -9350,6 +9350,46 @@ + SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lihash" + fi + ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 ++$as_echo_n "checking for clock_gettime in -lrt... " >&6; } ++if ${ac_cv_lib_rt_clock_gettime+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lrt $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char clock_gettime (); ++int ++main () ++{ ++return clock_gettime (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_rt_clock_gettime=yes ++else ++ ac_cv_lib_rt_clock_gettime=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 ++$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } ++if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : ++ SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lrt" ++fi ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for proc_stat_list_create in -lps" >&5 + $as_echo_n "checking for proc_stat_list_create in -lps... " >&6; } + if ${ac_cv_lib_ps_proc_stat_list_create+:} false; then : +
diff --git a/dpkg.tar.bz2 b/dpkg.tar.bz2 new file mode 100644 index 0000000..6e1ec0f --- /dev/null +++ b/dpkg.tar.bz2 Binary files differ
diff --git a/dpkg.url b/dpkg.url new file mode 100644 index 0000000..4f74d70 --- /dev/null +++ b/dpkg.url
@@ -0,0 +1 @@ +http://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.16.1.1.tar.bz2
diff --git a/dpkg.version b/dpkg.version new file mode 100644 index 0000000..3407906 --- /dev/null +++ b/dpkg.version
@@ -0,0 +1 @@ +1.16.1.1