pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

vhdtool-git: Import vhdtool-master as wip/vhdtool-git



Module Name:	pkgsrc-wip
Committed By:	Dean Matzkov <bapabooiee%gmail.com@localhost>
Pushed By:	bapa
Date:		Thu Mar 1 21:38:55 2018 -0700
Changeset:	9dbce5624625b22e5203bd2a0237d0c9926a2068

Modified Files:
	Makefile
Added Files:
	vhdtool-git/DESCR
	vhdtool-git/Makefile
	vhdtool-git/PLIST
	vhdtool-git/TODO
	vhdtool-git/distinfo
	vhdtool-git/patches/patch-Makefile
	vhdtool-git/patches/patch-vhdtool.c

Log Message:
vhdtool-git: Import vhdtool-master as wip/vhdtool-git

A tool to convert raw .IMG files into Microsoft .VHD/.VHDX format.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9dbce5624625b22e5203bd2a0237d0c9926a2068

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                            |  1 +
 vhdtool-git/DESCR                   |  1 +
 vhdtool-git/Makefile                | 29 ++++++++++++++++
 vhdtool-git/PLIST                   |  3 ++
 vhdtool-git/TODO                    | 17 ++++++++++
 vhdtool-git/distinfo                |  4 +++
 vhdtool-git/patches/patch-Makefile  | 16 +++++++++
 vhdtool-git/patches/patch-vhdtool.c | 66 +++++++++++++++++++++++++++++++++++++
 8 files changed, 137 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 52a40737ab..7715763fc7 100644
--- a/Makefile
+++ b/Makefile
@@ -4531,6 +4531,7 @@ SUBDIR+=	vdesk
 SUBDIR+=	vee
 SUBDIR+=	verbiste
 SUBDIR+=	verilator
+SUBDIR+=	vhdtool-git
 SUBDIR+=	vidalia
 SUBDIR+=	vidalia-devel
 SUBDIR+=	vidrioclock
diff --git a/vhdtool-git/DESCR b/vhdtool-git/DESCR
new file mode 100644
index 0000000000..72a8127d97
--- /dev/null
+++ b/vhdtool-git/DESCR
@@ -0,0 +1 @@
+Tool to convert raw .IMG files into Microsoft .VHD/.VHDX format.
diff --git a/vhdtool-git/Makefile b/vhdtool-git/Makefile
new file mode 100644
index 0000000000..f030627bfc
--- /dev/null
+++ b/vhdtool-git/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD$
+PKGNAME=		vhdtool-0.1
+CATEGORIES=		converters
+GIT_REPOSITORIES=		vhdtool
+GIT_REPO.vhdtool=		git://github.com/andreiw/vhdtool
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/andreiw/vhdtool
+COMMENT=	Tool to convert raw .IMG files into Microsoft .VHD/.VHDX format
+LICENSE=	gnu-gpl-v2
+
+ONLY_FOR_PLATFORM= Linux-*-x86_64
+
+USE_LANGUAGES=	c
+USE_TOOLS+=	gmake
+LDFLAGS+=	-luuid
+
+INSTALLATION_DIRS+=		bin
+INSTALLATION_DIRS+=		share/doc/${PKGBASE}
+
+WRKSRC=	${WRKDIR}/vhdtool
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/vhdtool ${DESTDIR}${PREFIX}/bin
+	${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
+
+.include "../../wip/mk/git-package.mk"
+.include "../../devel/libuuid/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/vhdtool-git/PLIST b/vhdtool-git/PLIST
new file mode 100644
index 0000000000..4b5ddf0c32
--- /dev/null
+++ b/vhdtool-git/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD$
+bin/vhdtool
+share/doc/vhdtool/README
diff --git a/vhdtool-git/TODO b/vhdtool-git/TODO
new file mode 100644
index 0000000000..d20390ad5c
--- /dev/null
+++ b/vhdtool-git/TODO
@@ -0,0 +1,17 @@
+- The #ifdef mess used in patch-vhdtool.c is pretty hacky and there's
+  likely a better way to deal with platform differences.
+
+- Given the above, testing is also needed to make sure large files
+  actually work on various platforms.
+
+- Fix build on macOS: For some strange reason, buildlink isn't pulling
+  in libuuid as a dep (despite the existence of `.buildlink_libuuid_done').
+
+- Remove ONLY_FOR_PLATFORM: It'd probably build/work fine for macOS once the
+  libuuid issue is reolved. And for 64-bit NetBSD it builds fine if we
+  define lseek64 as lseek, but it hasn't been tested or verified if that's
+  the correct thing to do.
+
+- Write a proper DESCR so that it isn't just a copy of COMMENT.
+
+- See if `converters' is the best CATEGORY for this kind of tool.
diff --git a/vhdtool-git/distinfo b/vhdtool-git/distinfo
new file mode 100644
index 0000000000..67072d7604
--- /dev/null
+++ b/vhdtool-git/distinfo
@@ -0,0 +1,4 @@
+$NetBSD$
+
+SHA1 (patch-Makefile) = fc1e7dd9987d1fbf9983af5727670f40f07c9de2
+SHA1 (patch-vhdtool.c) = 24884496f7873cff84b9143fdc828d3a6a1fd57c
diff --git a/vhdtool-git/patches/patch-Makefile b/vhdtool-git/patches/patch-Makefile
new file mode 100644
index 0000000000..2e5de94140
--- /dev/null
+++ b/vhdtool-git/patches/patch-Makefile
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Make the Makefile honor CC/CFLAGS/LDFLAGS.
+
+--- Makefile.orig	2018-03-02 01:52:07.000000000 +0000
++++ Makefile
+@@ -1,6 +1,6 @@
+-CC	:= gcc
+-CFLAGS	:= -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -g2
+-LDFLAGS := -luuid
++CC	?= gcc
++CFLAGS	?= -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -g2
++LDFLAGS ?= -luuid
+ 
+ all: vhdtool
+ 
diff --git a/vhdtool-git/patches/patch-vhdtool.c b/vhdtool-git/patches/patch-vhdtool.c
new file mode 100644
index 0000000000..74a00abbac
--- /dev/null
+++ b/vhdtool-git/patches/patch-vhdtool.c
@@ -0,0 +1,66 @@
+$NetBSD$
+
+This is a quick hack to get other platforms besides Linux to work, via:
+
+  1) on Darwin/macOS, off64_t is undefined, but off_t is guaranteed to
+     always be 64-bit, so define it as that.
+
+  2) For the same reason above, use lseek instead of lseek64 on macOS.
+
+  3) Deal with endian.h being found in different places on Linux & BSD.
+
+--- vhdtool.c.orig	2018-03-02 03:47:49.000000000 +0000
++++ vhdtool.c
+@@ -21,9 +21,19 @@
+ #define _GNU_SOURCE
+ #define _FILE_OFFSET_BITS 64
+ 
++#if defined(__APPLE__) || ! defined(off64_t)
++	#define off64_t off_t // on macOS, off64_t isn't defined, and off_t is always 64-bit
++#endif
++
+ #include <errno.h>
+ #include <stdio.h>
+-#include <endian.h>
++
++#ifdef __linux__
++	#include <endian.h>
++#else
++	#include <machine/endian.h>
++#endif
++
+ #include <inttypes.h>
+ #include <string.h>
+ #include <getopt.h>
+@@ -34,6 +44,13 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ 
++#if defined(__APPLE__) && ! defined(lseek64)
++	#define LSEEK lseek // lseek is guaranteed to handle big files on macOS
++#else
++	#define LSEEK lseek64
++#endif
++
++
+ #define COOKIE(x)           (*(uint64_t *) x)
+ #define COOKIE32(x)         (*(uint32_t *) x)
+ #define FOOTER_FEAT_RSVD    (2)
+@@ -152,7 +169,7 @@ int vhd_read(struct vhd *vhd,
+ 	     void *buf,
+ 	     size_t size)
+ {
+-	if (lseek64(vhd->fd, vhd->offset, SEEK_SET) != vhd->offset) {
++	if (LSEEK(vhd->fd, vhd->offset, SEEK_SET) != vhd->offset) {
+ 		fprintf(stderr, "Error: couldn't seek '%s': %s\n",
+ 			vhd->name, strerror(errno));
+ 		return -1;
+@@ -172,7 +189,7 @@ int vhd_write(struct vhd *vhd,
+ 	      void *buf,
+ 	      size_t size)
+ {
+-	if (lseek64(vhd->fd, vhd->offset, SEEK_SET) != vhd->offset) {
++	if (LSEEK(vhd->fd, vhd->offset, SEEK_SET) != vhd->offset) {
+ 		fprintf(stderr, "Error: couldn't seek '%s': %s\n",
+ 			vhd->name, strerror(errno));
+ 		return -1;


Home | Main Index | Thread Index | Old Index