From 46597d3b17c47f11da27b301d65b8034476ff281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 4 Oct 2012 12:18:15 +0200 Subject: [PATCH] Noux: add noux-pkg/openssh --- ports/ports/openssh.mk | 22 +++++++ ports/src/noux-pkg/openssh/includes_h.patch | 12 ++++ .../noux-pkg/openssh/monitor_fdpass.c.patch | 16 +++++ ports/src/noux-pkg/openssh/sshconnect.h.patch | 20 ++++++ ports/src/noux-pkg/openssh/target.mk | 64 +++++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 ports/ports/openssh.mk create mode 100644 ports/src/noux-pkg/openssh/includes_h.patch create mode 100644 ports/src/noux-pkg/openssh/monitor_fdpass.c.patch create mode 100644 ports/src/noux-pkg/openssh/sshconnect.h.patch create mode 100644 ports/src/noux-pkg/openssh/target.mk diff --git a/ports/ports/openssh.mk b/ports/ports/openssh.mk new file mode 100644 index 0000000000..3f15a32a5b --- /dev/null +++ b/ports/ports/openssh.mk @@ -0,0 +1,22 @@ +OPENSSH = openssh-6.1p1 +OPENSSH_TGZ = $(OPENSSH).tar.gz +OPENSSH_URL = ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$(OPENSSH).tar.gz + +# +# Interface to top-level prepare Makefile +# +PORTS += $(OPENSSH) + +prepare:: $(CONTRIB_DIR)/$(OPENSSH) + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(OPENSSH_TGZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(OPENSSH_URL) && touch $@ + +$(CONTRIB_DIR)/$(OPENSSH): $(DOWNLOAD_DIR)/$(OPENSSH_TGZ) + $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ + $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/monitor_fdpass.c.patch + $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/sshconnect.h.patch + $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/includes_h.patch diff --git a/ports/src/noux-pkg/openssh/includes_h.patch b/ports/src/noux-pkg/openssh/includes_h.patch new file mode 100644 index 0000000000..3b8eba064d --- /dev/null +++ b/ports/src/noux-pkg/openssh/includes_h.patch @@ -0,0 +1,12 @@ +--- openssh-6.1p1/includes.h.orig 2012-11-14 16:18:25.970072293 +0100 ++++ openssh-6.1p1/includes.h 2012-11-14 16:18:48.860209365 +0100 +@@ -18,7 +18,8 @@ + + #include "config.h" + +-#define _GNU_SOURCE /* activate extra prototypes for glibc */ ++/* already defined by noux.mk */ ++//#define _GNU_SOURCE /* activate extra prototypes for glibc */ + + #include + #include /* For CMSG_* */ diff --git a/ports/src/noux-pkg/openssh/monitor_fdpass.c.patch b/ports/src/noux-pkg/openssh/monitor_fdpass.c.patch new file mode 100644 index 0000000000..c8891c52b6 --- /dev/null +++ b/ports/src/noux-pkg/openssh/monitor_fdpass.c.patch @@ -0,0 +1,16 @@ +We do not have poll.h and since struct pollfd etc. pp is defined in +sys/poll.h we use it instead. + +--- openssh-6.1p1/monitor_fdpass.c.orig ++++ openssh-6.1p1/monitor_fdpass.c +@@ -36,6 +36,10 @@ + #include + #ifdef HAVE_POLL_H + #include ++#else ++# ifdef HAVE_SYS_POLL_H ++# include ++# endif + #endif + #include + #include diff --git a/ports/src/noux-pkg/openssh/sshconnect.h.patch b/ports/src/noux-pkg/openssh/sshconnect.h.patch new file mode 100644 index 0000000000..8c3c5c2b96 --- /dev/null +++ b/ports/src/noux-pkg/openssh/sshconnect.h.patch @@ -0,0 +1,20 @@ +set*uid() is not implemented but it does not matter anyway because there +is only one user per noux instance. + +--- openssh-6.1p1/sshconnect.h.orig ++++ openssh-6.1p1/sshconnect.h +@@ -55,6 +55,7 @@ void ssh_userauth2(const char *, const char *, char *, Sensitive *); + void ssh_put_password(char *); + int ssh_local_cmd(const char *); + ++#if 0 + /* + * Macros to raise/lower permissions. + */ +@@ -73,3 +74,6 @@ int ssh_local_cmd(const char *); + strerror(errno)); \ + errno = save_errno; \ + } while (0) ++#endif ++#define PRIV_START ++#define PRIV_END diff --git a/ports/src/noux-pkg/openssh/target.mk b/ports/src/noux-pkg/openssh/target.mk new file mode 100644 index 0000000000..98a8f26126 --- /dev/null +++ b/ports/src/noux-pkg/openssh/target.mk @@ -0,0 +1,64 @@ +TARGET = openssh + +# +# This prefix 'magic' is needed because OpenSSH uses $exec_prefix +# while compiling (e.g. -DSSH_PATH) and in the end the $prefix and +# $exec_prefix path differ. +# +NOUX_CONFIGURE_ARGS += --disable-ip6 \ + --with-md5-passwords \ + --without-zlib-version-check \ + --with-ssl-engine \ + --disable-finger \ + --disable-gopher \ + --disable-news \ + --disable-ftp \ + --disable-rpath-hack \ + --disable-utmpx \ + --disable-strip \ + --exec-prefix= \ + --bindir=/bin \ + --sbindir=/bin \ + --libexecdir=/bin + +LIBS += libcrypto libssl zlib libc_resolv + +noux_built.tag: Makefile Makefile_patch + +Makefile_patch: Makefile + @# + @# Our $(LDFLAGS) contain options which are usable by gcc(1) + @# only. So instead of using ld(1) to link the binary, we have + @# to use gcc(1). + @# + $(VERBOSE)sed -i 's|^LD=.*|LD=$(CC)|' Makefile + @# + @# We do not want to generate host-keys because we are crosscompiling + @# and we can not run Genode binaries on the build system. + @# + $(VERBOSE)sed -i 's|^install:.*||' Makefile + $(VERBOSE)sed -i 's|^install-nokeys:|install:|' Makefile + @# + @# The path of ssh(1) is hardcoded to $(bindir)/ssh which in our + @# case is insufficient. + @# + $(VERBOSE)sed -i 's|^SSH_PROGRAM=.*|SSH_PROGRAM=/bin/ssh|' Makefile + + +# +# Make the zlib linking test succeed +# +Makefile: dummy_libs + +NOUX_LDFLAGS += -L$(PWD) + +dummy_libs: libz.a libcrypto.a libssl.a + +libcrypto.a: + $(VERBOSE)$(AR) -rc $@ +libssl.a: + $(VERBOSE)$(AR) -rc $@ +libz.a: + $(VERBOSE)$(AR) -rc $@ + +include $(REP_DIR)/mk/noux.mk