hfsprogs: update to 540.1.linux3.

This commit is contained in:
maxice8 2018-02-27 08:54:14 -03:00 committed by Leаh Neukirchen
parent cbae9eb6a7
commit 2dd06ea329
4 changed files with 305 additions and 26 deletions

View file

@ -0,0 +1,13 @@
--- Makefile
+++ Makefile
@@ -1,8 +1,8 @@
VERSION=540.1.linux3
CC := clang
-CFLAGS := -g3 -Wall -fblocks -I$(PWD)/BlocksRunTime -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\"
-LDFLAGS := -Wl,--build-id -L$(PWD)/BlocksRunTime
+CFLAGS := -g3 -Wall -fblocks -I$(PWD)/BlocksRunTime -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\" -fPIC -fPIE
+LDFLAGS := -Wl,--build-id -L$(PWD)/BlocksRunTime -pie
SUBDIRS := BlocksRunTime newfs_hfs.tproj fsck_hfs.tproj
all clean:

View file

@ -0,0 +1,122 @@
Patch-Source: https://src.fedoraproject.org/rpms/hfsplus-tools/blob/f27/f/hfsplus-tools-learn-to-stdarg.patch
--- fsck_hfs.tproj/utilities.c.jx 2012-02-01 12:17:19.000000000 -0500
+++ fsck_hfs.tproj/utilities.c 2014-06-18 13:44:45.125620007 -0400
@@ -296,11 +296,8 @@ static volatile int keep_going = 1;
#undef printf
// prototype
-void print_to_mem(int type, const char *fmt, const char *str, va_list ap);
-
-#define DO_VPRINT 1 // types for print_to_mem
-#define DO_STR 2
-
+void vprint_to_mem(const char *fmt, va_list ap);
+void print_to_mem(const char *fmt, ...);
static void *
fsck_printing_thread(void *arg)
@@ -547,8 +544,8 @@ setup_logging(void)
cur_in_mem = in_mem_log;
t = time(NULL);
- print_to_mem(DO_STR, "\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV", NULL);
- print_to_mem(DO_STR, "fsck_hfs run at %s", ctime(&t), NULL);
+ print_to_mem("\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV");
+ print_to_mem("fsck_hfs run at %s", ctime(&t));
if (live_fsck && log_file) {
pthread_cond_init(&mem_buf_cond, NULL);
@@ -576,26 +573,20 @@ setup_logging(void)
void
-print_to_mem(int type, const char *fmt, const char *str, va_list ap)
+vprint_to_mem(const char *fmt, va_list ap)
{
int ret;
size_t size_remaining;
va_list ap_copy;
- if (type == DO_VPRINT) {
- va_copy(ap_copy, ap);
- }
+ va_copy(ap_copy, ap);
if (live_fsck) {
pthread_mutex_lock(&mem_buf_lock);
}
size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - in_mem_log);
- if (type == DO_VPRINT) {
- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
- } else {
- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
- }
+ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
if (ret > size_remaining) {
char *new_log;
size_t amt;
@@ -619,11 +610,7 @@ print_to_mem(int type, const char *fmt,
cur_in_mem = new_log + (cur_in_mem - in_mem_log);
in_mem_log = new_log;
size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - new_log);
- if (type == DO_VPRINT) {
- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
- } else {
- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
- }
+ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
if (ret <= size_remaining) {
cur_in_mem += ret;
}
@@ -636,11 +623,18 @@ print_to_mem(int type, const char *fmt,
pthread_mutex_unlock(&mem_buf_lock);
}
done:
- if (type == DO_VPRINT) {
- va_end(ap_copy);
- }
+ va_end(ap_copy);
}
+void
+print_to_mem(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprint_to_mem(fmt, ap);
+ va_end(ap);
+}
static int need_prefix=1;
@@ -662,7 +656,7 @@ static int need_prefix=1;
LOG_PREFIX \
vfprintf(log_file, fmt, ap); \
} else { \
- print_to_mem(DO_VPRINT, fmt, NULL, ap); \
+ vprint_to_mem(fmt, ap); \
}
#define FLOG(fmt, str) \
@@ -670,7 +664,7 @@ static int need_prefix=1;
LOG_PREFIX; \
fprintf(log_file, fmt, str); \
} else { \
- print_to_mem(DO_STR, fmt, str, NULL); \
+ print_to_mem(fmt, str); \
}
@@ -800,7 +794,7 @@ vplog(const char *fmt, va_list ap)
LOG_PREFIX;
vfprintf(log_file, fmt, ap);
} else {
- print_to_mem(DO_VPRINT, fmt, NULL, ap);
+ vprint_to_mem(fmt, ap);
}
}

View file

@ -0,0 +1,137 @@
--- fsck_hfs.tproj/dfalib/Scavenger.h
+++ fsck_hfs.tproj/dfalib/Scavenger.h
@@ -48,7 +48,6 @@
#endif
#include <sys/errno.h>
#include <sys/param.h>
-#include <sys/sysctl.h>
#include <sys/mount.h>
#include <hfs/hfs_mount.h>
--- fsck_hfs.tproj/fsck_hfs.c
+++ fsck_hfs.tproj/fsck_hfs.c
@@ -30,7 +30,6 @@
#include <sys/ioctl.h>
#if !LINUX
#include <sys/disk.h>
-#include <sys/sysctl.h>
#include <setjmp.h>
#endif
#include <hfs/hfs_mount.h>
--- newfs_hfs.tproj/makehfs.c
+++ newfs_hfs.tproj/makehfs.c
@@ -38,7 +38,6 @@
#endif
#include <sys/errno.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
#if !LINUX
#include <sys/vmmeter.h>
#endif
--- fsck_hfs.tproj/utilities.c
+++ fsck_hfs.tproj/utilities.c
@@ -70,7 +70,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/sysctl.h>
#include "fsck_hfs.h"
--- fsck_hfs.tproj/dfalib/Scavenger.h
+++ fsck_hfs.tproj/dfalib/Scavenger.h
@@ -46,7 +46,7 @@
#include <sys/kauth.h>
#include <sys/syslimits.h>
#endif
-#include <sys/errno.h>
+#include <errno.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <hfs/hfs_mount.h>
--- fsck_hfs.tproj/utilities.c
+++ fsck_hfs.tproj/utilities.c
@@ -55,7 +55,7 @@
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/errno.h>
+#include <errno.h>
#if LINUX
#include <limits.h>
#include <signal.h>
--- newfs_hfs.tproj/makehfs.c
+++ newfs_hfs.tproj/makehfs.c
@@ -36,7 +36,7 @@
#include <time.h>
#include "missing.h"
#endif
-#include <sys/errno.h>
+#include <errno.h>
#include <sys/stat.h>
#if !LINUX
#include <sys/vmmeter.h>
--- fsck_hfs.tproj/cache.h
+++ fsck_hfs.tproj/cache.h
@@ -29,6 +29,7 @@
#ifndef _CACHE_H_
#define _CACHE_H_
#include <stdint.h>
+#include <sys/types.h>
/* Different values for initializing cache */
enum {
--- newfs_hfs.tproj/makehfs.c
+++ newfs_hfs.tproj/makehfs.c
@@ -41,6 +41,7 @@
#if !LINUX
#include <sys/vmmeter.h>
#endif
+#include <sys/cdefs.h>
#include <err.h>
#include <errno.h>
--- newfs_hfs.tproj/newfs_hfs.c
+++ newfs_hfs.tproj/newfs_hfs.c
@@ -42,6 +42,7 @@
#if LINUX
#include <time.h>
#endif
+#include <sys/cdefs.h>
#if !LINUX
#include <IOKit/storage/IOMediaBSDClient.h>
--- fsck_hfs.tproj/fsck_hfs.h
+++ fsck_hfs.tproj/fsck_hfs.h
@@ -22,6 +22,7 @@
*/
#include "cache.h"
+#include <sys/cdefs.h>
const extern char *cdevname; /* name of device being checked */
--- fsck_hfs.tproj/utilities.c
+++ fsck_hfs.tproj/utilities.c
@@ -785,7 +785,7 @@
if (!live_fsck) {
/* copy va_list as it will be used again later */
- __va_copy(ap_stdout, ap);
+ va_copy(ap_stdout, ap);
vfprintf(stdout, fmt, ap_stdout);
}
--- fsck_hfs.tproj/fsck_messages.c
+++ fsck_hfs.tproj/fsck_messages.c
@@ -85,7 +85,7 @@
if (c == NULL)
return;
- __va_copy(ap2, ap); // Just in case we need it
+ va_copy(ap2, ap); // Just in case we need it
length = vsnprintf(buf, BUFSIZ, fmt, ap);
if (length > BUFSIZ) {
// We need to allocate space for it

View file

@ -1,38 +1,45 @@
# Template file for 'hfsprogs'
pkgname=hfsprogs
_distver=332.25
_patchver=11
version=${_distver}debian${_patchver}
revision=9
create_wrksrc=yes
makedepends="libbsd-devel libressl-devel"
short_desc="mkfs and fsck for HFS and HFS+ file systems"
_distver=540.1
_patchver=3
version=${_distver}.linux${_patchver}
revision=1
wrksrc="diskdev_cmds-${version}"
hostmakedepends="clang"
makedepends="libressl-devel libuuid-devel"
short_desc="Apple's mkfs and fsck for HFS and HFS+ file systems"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="APSL-2.0"
homepage="http://www.opensource.apple.com/"
distfiles="
${DEBIAN_SITE}/main/h/${pkgname}/${pkgname}_${_distver}.orig.tar.gz
${DEBIAN_SITE}/main/h/${pkgname}/${pkgname}_${_distver}-${_patchver}.debian.tar.gz"
checksum="
74c9aeca899ed7f4bf155c65fc45bf0f250c0f6d57360ea953b1d536d9aa45e6
62d9b8599c66ebffbc57ce5d776e20b41341130d9b27341d63bda08460ebde7c"
distfiles="http://cavan.codon.org.uk/~mjg59/diskdev_cmds/diskdev_cmds-${version}.tar.gz"
checksum=b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497
nocross="clang can't link cross-compiled fsck_hfs"
post_extract() {
cd ${wrksrc}/diskdev*
for f in ${wrksrc}/debian/patches/*.patch; do
patch -Np1 -i ${f}
done
pre_build() {
sed -i 's/[F|f]sck_hfs/fsck.hfsplus/g' fsck_hfs.tproj/fsck_hfs.8
sed -i 's/[N|n]ewfs_hfs/mkfs.hfsplus/g' newfs_hfs.tproj/newfs_hfs.8
# Remove errant execute bits.
find . -type f -name '*.[ch]' -exec chmod -c -x {} +
}
do_build() {
cd ${wrksrc}/diskdev*
make -f Makefile.lnx CC=$CC STRIP=true ${makejobs}
make ${makejobs}
}
do_check() {
./fsck_hfs.tproj/fsck_hfs 2>&1 | grep 'usage: fsck_hfs'
./newfs_hfs.tproj/newfs_hfs 2>&1 | grep 'usage: newfs_hfs'
}
do_install() {
cd ${wrksrc}/diskdev*
vinstall newfs_hfs.tproj/hfsbootdata.img 644 usr/share/hfsprogs hfsbootdata
vbin fsck_hfs.tproj/fsck_hfs fsck.hfs
vbin newfs_hfs.tproj/newfs_hfs mkfs.hfsplus
vbin fsck_hfs.tproj/fsck_hfs fsck.hfsplus
vman newfs_hfs.tproj/newfs_hfs.8 mkfs.hfsplus.8
vman fsck_hfs.tproj/fsck_hfs.8 fsck.hfsplus.8
vlicense ${FILESDIR}/APSL-2.0
ln -s /usr/bin/fsck.hfs "${DESTDIR}"/usr/bin/fsck.hfsplus
vman fsck_hfs.tproj/fsck_hfs.8
vman newfs_hfs.tproj/newfs_hfs.8
ln -s fsck.hfs.8 "${DESTDIR}"/usr/share/man/man8/fsck.hfs.8
vlicense "${FILESDIR}"/APSL-2.0
}