Compare commits

...

2 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 0c93ea4f97 Add dosfstools port. 2023-12-26 21:54:48 +01:00
Jonas 'Sortie' Termansen 43adfbb82e Add mtools port. 2023-12-26 21:54:48 +01:00
5 changed files with 205 additions and 0 deletions

View File

@ -0,0 +1,43 @@
diff -Paur --no-dereference -- dosfstools.upstream/src/blkdev/blkdev.c dosfstools/src/blkdev/blkdev.c
--- dosfstools.upstream/src/blkdev/blkdev.c
+++ dosfstools/src/blkdev/blkdev.c
@@ -7,7 +7,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include <sys/sysmacros.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
diff -Paur --no-dereference -- dosfstools.upstream/src/common.c dosfstools/src/common.c
--- dosfstools.upstream/src/common.c
+++ dosfstools/src/common.c
@@ -297,16 +297,7 @@
uint32_t generate_volume_id(void)
{
- struct timeval now;
-
- if (gettimeofday(&now, NULL) != 0 || now.tv_sec == (time_t)-1 || now.tv_sec < 0) {
- srand(getpid());
- /* rand() returns int from [0,RAND_MAX], therefore only 31 bits */
- return (((uint32_t)(rand() & 0xFFFF)) << 16) | ((uint32_t)(rand() & 0xFFFF));
- }
-
- /* volume ID = current time, fudged for more uniqueness */
- return ((uint32_t)now.tv_sec << 20) | (uint32_t)now.tv_usec;
+ return arc4random();
}
/*
diff -Paur --no-dereference -- dosfstools.upstream/src/device_info.c dosfstools/src/device_info.c
--- dosfstools.upstream/src/device_info.c
+++ dosfstools/src/device_info.c
@@ -24,7 +24,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include <sys/sysmacros.h>
#ifdef HAVE_LINUX_LOOP_H
#include <linux/loop.h>

View File

@ -0,0 +1,12 @@
NAME=dosfstools
BUILD_LIBRARIES=libiconv?
VERSION=4.2
DISTNAME=$NAME-$VERSION
COMPRESSION=tar.gz
ARCHIVE=$DISTNAME.$COMPRESSION
SHA256SUM=64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527
UPSTREAM_SITE=https://github.com/dosfstools/dosfstools/releases/download/v$VERSION
UPSTREAM_ARCHIVE=$ARCHIVE
LICENSE=GPL-3.0-or-later
BUILD_SYSTEM=configure
DEVELOPMENT=true

136
ports/mtools/mtools.patch Normal file
View File

@ -0,0 +1,136 @@
diff -Paur --no-dereference -- mtools.upstream/configure mtools/configure
--- mtools.upstream/configure
+++ mtools/configure
@@ -3964,17 +3964,11 @@
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 iconv ();
+#include <iconv.h>
int
main ()
{
-return iconv ();
+return (int) iconv;
;
return 0;
}
diff -Paur --no-dereference -- mtools.upstream/file.c mtools/file.c
--- mtools.upstream/file.c
+++ mtools/file.c
@@ -522,7 +522,7 @@
extern long timezone;
#endif
tzset();
- tzone = (long) timezone;
+ tzone = (long) 0;
}
#else
tzone = 0;
diff -Paur --no-dereference -- mtools.upstream/mainloop.h mtools/mainloop.h
--- mtools.upstream/mainloop.h
+++ mtools/mainloop.h
@@ -18,7 +18,6 @@
* along with Mtools. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <sys/param.h>
#include "mtoolsDirentry.h"
typedef struct bounded_string {
diff -Paur --no-dereference -- mtools.upstream/mcopy.c mtools/mcopy.c
--- mtools.upstream/mcopy.c
+++ mtools/mcopy.c
@@ -39,28 +39,12 @@
static void set_mtime(const char *target, time_t mtime)
{
if (target && strcmp(target, "-") && mtime != 0L) {
-#ifdef HAVE_UTIMES
- struct timeval tv[2];
- tv[0].tv_sec = mtime;
- tv[0].tv_usec = 0;
- tv[1].tv_sec = mtime;
- tv[1].tv_usec = 0;
- utimes(target, tv);
-#else
-#ifdef HAVE_UTIME
-#ifndef HAVE_UTIMBUF
- struct utimbuf {
- time_t actime; /* access time */
- time_t modtime; /* modification time */
- };
-#endif
- struct utimbuf utbuf;
-
- utbuf.actime = mtime;
- utbuf.modtime = mtime;
- utime(target, &utbuf);
-#endif
-#endif
+ struct timespec ts[2];
+ ts[0].tv_sec = mtime;
+ ts[0].tv_nsec = 0;
+ ts[1].tv_sec = mtime;
+ ts[1].tv_nsec = 0;
+ utimens(target, ts);
}
return;
}
diff -Paur --no-dereference -- mtools.upstream/plain_io.c mtools/plain_io.c
--- mtools.upstream/plain_io.c
+++ mtools/plain_io.c
@@ -145,7 +145,10 @@
static int init_geom_with_reg(int fd, struct device *dev,
struct device *orig_dev,
struct MT_STAT *statbuf) {
+ // TODO: Actually use the geometry but the partition has to report it.
+#ifndef __sortix__
if(S_ISREG(statbuf->st_mode)) {
+#endif
/* Regular file (image file) */
mt_off_t sectors;
if(statbuf->st_size == 0) {
@@ -161,10 +164,12 @@
? UINT32_MAX
: (uint32_t) sectors;
return 0;
+#ifndef __sortix__
} else {
/* All the rest (devices, etc.) */
return init_geom(fd, dev, orig_dev, statbuf);
}
+#endif
}
static int file_geom(Stream_t *Stream, struct device *dev,
diff -Paur --no-dereference -- mtools.upstream/sysincludes.h mtools/sysincludes.h
--- mtools.upstream/sysincludes.h
+++ mtools/sysincludes.h
@@ -397,19 +397,11 @@
/* missing functions */
#ifndef HAVE_SRANDOM
-# ifdef OS_mingw32msvc
-# define srandom srand
-# else
-# define srandom srand48
-# endif
+# define srandom
#endif
#ifndef HAVE_RANDOM
-# ifdef OS_mingw32msvc
-# define random (long)rand
-# else
-# define random (long)lrand48
-# endif
+# define random (long)arc4random
#endif
#ifndef HAVE_STRCHR

11
ports/mtools/mtools.port Normal file
View File

@ -0,0 +1,11 @@
NAME=mtools
BUILD_LIBRARIES='libiconv'
VERSION=4.0.43
DISTNAME=$NAME-$VERSION
COMPRESSION=tar.bz2
ARCHIVE=$DISTNAME.$COMPRESSION
SHA256SUM=541e179665dc4e272b9602f2074243591a157da89cc47064da8c5829dbd2b339
UPSTREAM_SITE=https://ftp.gnu.org/gnu/mtools
UPSTREAM_ARCHIVE=$ARCHIVE
LICENSE=GPL-3.0-or-later
BUILD_SYSTEM=configure

View File

@ -0,0 +1,3 @@
rm -rf -- 'mtools.info'
rm -rf -- 'mtools.1'
rm -rf -- 'mtools.5'