commit: cb743d8979cd73aa2b9dd3f05c55c50126e8356a
parent 1fd5b3a666ba1e3ea2c387292eab90a61dc97967
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 14 Jun 2019 12:58:22 -0700
openbsd: Build rsync
Diffstat:
6 files changed, 117 insertions(+), 0 deletions(-)
diff --git a/pkg/openbsd/.gitignore b/pkg/openbsd/.gitignore
@@ -1,4 +1,5 @@
/acme-client.ninja
+/rsync.ninja
/src
/src.tar.gz
/sys.tar.gz
diff --git a/pkg/openbsd/fetch.sh b/pkg/openbsd/fetch.sh
@@ -26,6 +26,7 @@ zcat src.tar.gz | ${PAXREAD:-pax -r} -s ',^,src/,' \
'usr.bin/m4/*' \
'usr.bin/nc/*' \
'usr.bin/patch/*' \
+ 'usr.bin/rsync/*' \
'usr.bin/yacc/*' \
'usr.sbin/acme-client/*'
zcat sys.tar.gz | ${PAXREAD:-pax -r} -s ',^[^/]*,src,' './sys/sys/*'
diff --git a/pkg/openbsd/gen.lua b/pkg/openbsd/gen.lua
@@ -93,6 +93,22 @@ sym('bin/tar', 'pax')
sym('bin/cpio', 'pax')
man{'bin/pax/pax.1', 'bin/pax/tar.1', 'bin/pax/cpio.1'}
+-- rsync
+sub('rsync.ninja', function()
+ cflags{'-I $builddir/pkg/libressl/include'}
+ exe('rsync', [[
+ usr.bin/rsync/(
+ blocks.c client.c downloader.c fargs.c flist.c hash.c ids.c
+ io.c log.c mkpath.c mktemp.c receiver.c sender.c server.c session.c
+ socket.c symlinks.c uploader.c main.c misc.c
+ )
+ libbsd.a
+ $builddir/pkg/libressl/libcrypto.a.d
+ ]], {'pkg/libressl/headers'})
+ file('bin/rsync', '755', '$outdir/rsync')
+ man{'usr.bin/rsync/rsync.1', 'usr.bin/rsync/rsync.5', 'usr.bin/rsync/rsyncd.5'}
+end)
+
-- yacc
exe('yacc', [[usr.bin/yacc/(
closure.c error.c lalr.c lr0.c main.c mkpar.c output.c reader.c
diff --git a/pkg/openbsd/patch/0025-rsync-Add-missing-includes.patch b/pkg/openbsd/patch/0025-rsync-Add-missing-includes.patch
@@ -0,0 +1,40 @@
+From ca34590e5d0065db581b3b4c05c9c7aea0015dff Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 14 Jun 2019 12:40:56 -0700
+Subject: [PATCH] rsync: Add missing includes
+
+- stdio.h in socket.c for sscanf
+- sys/types.h in extern.h for various type definitions
+---
+ usr.bin/rsync/extern.h | 2 ++
+ usr.bin/rsync/socket.c | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/usr.bin/rsync/extern.h b/usr.bin/rsync/extern.h
+index 305821be579..040588003a4 100644
+--- a/usr.bin/rsync/extern.h
++++ b/usr.bin/rsync/extern.h
+@@ -17,6 +17,8 @@
+ #ifndef EXTERN_H
+ #define EXTERN_H
+
++#include <sys/types.h>
++
+ /*
+ * This is the rsync protocol version that we support.
+ */
+diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c
+index 36384d063a0..43d8d7d01af 100644
+--- a/usr.bin/rsync/socket.c
++++ b/usr.bin/rsync/socket.c
+@@ -28,6 +28,7 @@
+ #include <poll.h>
+ #include <resolv.h>
+ #include <stdlib.h>
++#include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <err.h>
+--
+2.22.0
+
diff --git a/pkg/openbsd/patch/0026-rsync-Use-standard-S_ISVTX-instead-of-S_ISTXT.patch b/pkg/openbsd/patch/0026-rsync-Use-standard-S_ISVTX-instead-of-S_ISTXT.patch
@@ -0,0 +1,34 @@
+From 3de436f052626bc02b272e6eef65db5624ba22d1 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 14 Jun 2019 12:42:15 -0700
+Subject: [PATCH] rsync: Use standard S_ISVTX instead of S_ISTXT
+
+---
+ usr.bin/rsync/receiver.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c
+index c6d26cb0917..1ab080cb111 100644
+--- a/usr.bin/rsync/receiver.c
++++ b/usr.bin/rsync/receiver.c
+@@ -86,7 +86,7 @@ rsync_set_metadata(struct sess *sess, int newfile,
+ "to user.group: %u.%u", f->path, uid, gid);
+ } else
+ LOG4(sess, "%s: updated uid and/or gid", f->path);
+- mode &= ~(S_ISTXT | S_ISUID | S_ISGID);
++ mode &= ~(S_ISVTX | S_ISUID | S_ISGID);
+ }
+
+ /* Conditionally adjust file permissions. */
+@@ -147,7 +147,7 @@ rsync_set_metadata_at(struct sess *sess, int newfile, int rootfd,
+ "to user.group: %u.%u", f->path, uid, gid);
+ } else
+ LOG4(sess, "%s: updated uid and/or gid", f->path);
+- mode &= ~(S_ISTXT | S_ISUID | S_ISGID);
++ mode &= ~(S_ISVTX | S_ISUID | S_ISGID);
+ }
+
+ /* Conditionally adjust file permissions. */
+--
+2.22.0
+
diff --git a/pkg/openbsd/patch/0027-rsync-Use-1-instead-of-INFTIM-for-poll-timeout.patch b/pkg/openbsd/patch/0027-rsync-Use-1-instead-of-INFTIM-for-poll-timeout.patch
@@ -0,0 +1,25 @@
+From 588522657724047a2e4c838e62dfff5db41bd506 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 14 Jun 2019 12:44:02 -0700
+Subject: [PATCH] rsync: Use -1 instead of INFTIM for poll timeout
+
+---
+ usr.bin/rsync/extern.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr.bin/rsync/extern.h b/usr.bin/rsync/extern.h
+index 040588003a4..64a02349adc 100644
+--- a/usr.bin/rsync/extern.h
++++ b/usr.bin/rsync/extern.h
+@@ -47,7 +47,7 @@
+ * Use this for debugging deadlocks.
+ * All poll events will use it and catch time-outs.
+ */
+-#define POLL_TIMEOUT (INFTIM)
++#define POLL_TIMEOUT (-1)
+
+ /*
+ * Operating mode for a client or a server.
+--
+2.22.0
+