Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..20e2f89
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,138 @@
+#
+#    Copyright (c) 2010-2014 Nest, 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 make file for the GNU partition editor,
+#      parted.
+#
+
+
+include pre.mak
+
+PackageName		:= parted
+
+PackageExtension	:= tar.gz
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p0
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFile	:= $(PackageSourceDir)/COPYING
+
+CleanPaths		+= $(PackageLicenseFile)
+
+UUIDDir         	:= sw/tps/e2fsprogs
+UUIDIncDir      	= $(call GenerateResultPaths,$(UUIDDir),usr/include)
+UUIDLibDir      	= $(call GenerateResultPaths,$(UUIDDir),usr/lib)
+
+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) \
+	CPPFLAGS="$(call ToolGenerateIncludeArgument,$(UUIDIncDir))" \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	LDFLAGS="-L$(UUIDLibDir)" \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--target=$(TargetTuple) \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--localstatedir=/var \
+	--disable-device-mapper \
+	--disable-fs \
+	--enable-read-only \
+	--without-readline \
+	ac_cv_func_malloc_0_nonnull=yes \
+	ac_cv_func_realloc_0_nonnull=yes \
+	ac_cv_func_calloc_0_nonnull=yes \
+	--disable-static
+	$(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.
+#
+# We explictly remove 'libparted.la' because some packages that depend
+# on libparted use libtool. If libtool finds a '*.la' file for a
+# library, it uses the value of 'libdir=<dir>' it finds. In our case,
+# since '--prefix=/usr' this value is '/usr/lib'. It then resolves
+# '-lparted' to '/usr/lib/libparted.so'. In a cross-compilation
+# environment, this is likely to be neither the right architecture nor
+# the right version to link against. In short, we lose.
+#
+# We could also handle this by removing DESTDIR and setting the prefix
+# to $(ResultDirectory); however, that results in libtool hard-coding
+# $(ResultDirectory) as the RPATH in the linked executables which is
+# NOT what we want either. We lose again.
+#
+# By removing the '*.la' file, we win by ensuring neither a misdirected
+# link nor an RPATH.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
+	$(Verbose)$(RM) $(RMFLAGS) $(call GenerateResultPaths,,usr/lib/libparted.la)
+	$(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/parted.patches/parted-50.description b/parted.patches/parted-50.description
new file mode 100644
index 0000000..0b215a5
--- /dev/null
+++ b/parted.patches/parted-50.description
@@ -0,0 +1 @@
+Remove unused workaround for 64-bit PGC compiler that's causing a build error for us. 
diff --git a/parted.patches/parted-50.patch b/parted.patches/parted-50.patch
new file mode 100644
index 0000000..ff5e90f
--- /dev/null
+++ b/parted.patches/parted-50.patch
@@ -0,0 +1,13 @@
+--- lib/regex_internal.h	2007-02-14 16:16:55.000000000 -0800
++++ lib/regex_internal.h	2014-04-30 18:34:31.110773635 -0700
+@@ -182,10 +182,6 @@
+ # if BITSET_WORD_BITS <= SBC_MAX
+ #  error "Invalid SBC_MAX"
+ # endif
+-#elif BITSET_WORD_MAX == (0xffffffff + 2) * 0xffffffff
+-/* Work around a bug in 64-bit PGC (before version 6.1-2), where the
+-   preprocessor mishandles large unsigned values as if they were signed.  */
+-# define BITSET_WORD_BITS 64
+ #else
+ # error "Add case for new bitset_word_t size"
+ #endif
diff --git a/parted.patches/parted-51.description b/parted.patches/parted-51.description
new file mode 100644
index 0000000..ae36216
--- /dev/null
+++ b/parted.patches/parted-51.description
@@ -0,0 +1 @@
+Remove inline keyword from function prototype. Function inlined in definition.
diff --git a/parted.patches/parted-51.patch b/parted.patches/parted-51.patch
new file mode 100644
index 0000000..c44823c
--- /dev/null
+++ b/parted.patches/parted-51.patch
@@ -0,0 +1,15 @@
+--- include/parted/natmath.h	2007-04-18 14:12:10.000000000 -0700
++++ include/parted/natmath.h	2014-04-30 18:37:22.487991387 -0700
+@@ -87,10 +87,10 @@
+ extern const PedAlignment* ped_alignment_any;
+ extern const PedAlignment* ped_alignment_none;
+ 
+-extern inline PedSector
++extern PedSector
+ ped_div_round_up (PedSector numerator, PedSector divisor);
+ 
+-extern inline PedSector
++extern PedSector
+ ped_div_round_to_nearest (PedSector numerator, PedSector divisor);
+ 
+ #endif /* PED_NATMATH_H_INCLUDED */
diff --git a/parted.patches/parted-52.description b/parted.patches/parted-52.description
new file mode 100644
index 0000000..ee0bf70
--- /dev/null
+++ b/parted.patches/parted-52.description
@@ -0,0 +1 @@
+Allow FAT fs images without MBRs
diff --git a/parted.patches/parted-52.patch b/parted.patches/parted-52.patch
new file mode 100644
index 0000000..f1d4b6a
--- /dev/null
+++ b/parted.patches/parted-52.patch
@@ -0,0 +1,16 @@
+--- libparted/labels/dos.c	2014-11-13 14:23:10.147494213 -0800
++++ libparted/labels/dos.c	2014-11-13 14:28:54.262031054 -0800
+@@ -173,10 +173,12 @@ msdos_probe (const PedDevice *dev)
+ 	 * Loader (SBML) signature indicates a partition table, not a file
+ 	 * system.
+ 	 */
+-	if ((!strncmp (part_table.boot_code + 0x36, "FAT", 3)
++       /* check below commented out to allow FAT fs images without a MBR */ 
++/*	if ((!strncmp (part_table.boot_code + 0x36, "FAT", 3)
+ 	    && strncmp (part_table.boot_code + 0x40, "SBML", 4) != 0)
+ 	    || !strncmp (part_table.boot_code + 0x52, "FAT", 3))
+ 		return 0;
++*/
+ 
+ 	/* If this is a GPT disk, fail here */
+ 	for (i = 0; i < 4; i++) {
diff --git a/parted.patches/parted-53.description b/parted.patches/parted-53.description
new file mode 100644
index 0000000..2d86718
--- /dev/null
+++ b/parted.patches/parted-53.description
@@ -0,0 +1 @@
+O_DIRECT mode unsupported in Sapphire
diff --git a/parted.patches/parted-53.patch b/parted.patches/parted-53.patch
new file mode 100644
index 0000000..0385e2b
--- /dev/null
+++ b/parted.patches/parted-53.patch
@@ -0,0 +1,11 @@
+--- libparted/arch/linux.c	2014-11-13 14:23:10.147494213 -0800
++++ libparted/arch/linux.c	2014-11-13 15:18:09.673789395 -0800
+@@ -65,6 +65,8 @@
+ #define HDIO_GETGEO             0x0301  /* get device geometry */
+ #define HDIO_GET_IDENTITY       0x030d  /* get IDE identification info */
+ 
++/* O_DIRECT mode not supported in Sapphire */
++#undef O_DIRECT
+ #if defined(O_DIRECT) && (!defined(__s390__) || !defined(__s390x__))
+ #define RD_MODE (O_RDONLY | O_DIRECT)
+ #define WR_MODE (O_WRONLY | O_DIRECT)
diff --git a/parted.patches/parted-54.description b/parted.patches/parted-54.description
new file mode 100644
index 0000000..1fa9c6d
--- /dev/null
+++ b/parted.patches/parted-54.description
@@ -0,0 +1 @@
+Disable HAVE_CHECK when cross-compiling.
diff --git a/parted.patches/parted-54.patch b/parted.patches/parted-54.patch
new file mode 100644
index 0000000..6f0226a
--- /dev/null
+++ b/parted.patches/parted-54.patch
@@ -0,0 +1,22 @@
+--- configure	2007-05-09 14:01:27.000000000 -0700
++++ configure	2016-06-27 12:58:06.797149679 -0700
+@@ -36462,7 +36462,7 @@
+     { echo "$as_me:$LINENO: result: Unable to locate check version 0.9.3 or higher: not building" >&5
+ echo "${ECHO_T}Unable to locate check version 0.9.3 or higher: not building" >&6; }
+ fi
+- if test "$have_check" = yes; then
++ if test "$have_check" = yes && test "$cross_compiling" != yes; then
+   HAVE_CHECK_TRUE=
+   HAVE_CHECK_FALSE='#'
+ else
+--- configure.ac	2007-05-09 12:19:10.000000000 -0700
++++ configure.ac	2016-06-27 12:52:58.329202628 -0700
+@@ -450,7 +450,7 @@
+ if test "$have_scintilla" != "yes"; then
+     AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
+ fi
+-AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])
++AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes && test "$cross_compiling" != yes])
+ 
+ dnl Checks for typedefs, structures and compiler characteristics.
+ AC_PROG_LD
diff --git a/parted.tar.gz b/parted.tar.gz
new file mode 100644
index 0000000..8bea1e0
--- /dev/null
+++ b/parted.tar.gz
Binary files differ
diff --git a/parted.url b/parted.url
new file mode 100644
index 0000000..fe8720b
--- /dev/null
+++ b/parted.url
@@ -0,0 +1 @@
+http://ftp.gnu.org/pub/gnu/parted/parted-1.8.7.tar.gz
diff --git a/parted.version b/parted.version
new file mode 100644
index 0000000..88d3ee7
--- /dev/null
+++ b/parted.version
@@ -0,0 +1 @@
+1.8.7