commit:     1dbc9be7219d95a6c05f0cea520ec931d9e18541
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 15 18:57:28 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri Feb 15 18:57:43 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1dbc9be7

dev-libs/openssl: fix cygwin binmode

Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 .../files/openssl-1.1.1a-cygwin-binmode.patch      | 32 ++++++++++++++++++++++
 dev-libs/openssl/openssl-1.1.1a-r1.ebuild          |  4 +--
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch 
b/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch
new file mode 100644
index 0000000000..7ab2fd5065
--- /dev/null
+++ b/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch
@@ -0,0 +1,32 @@
+For the setmode(O_TEXT), not submitted upstream yet:
+https://cygwin.com/ml/cygwin/2019-02/msg00150.html
+https://cygwin.com/ml/cygwin/2019-02/msg00190.html
+
+For the chmod 644, accepted upstream:
+https://github.com/openssl/openssl/pull/8226
+--- openssl-1.1.1a/crypto/bio/bss_file.c.orig  2019-02-15 19:41:48.605378800 
+0100
++++ openssl-1.1.1a/crypto/bio/bss_file.c       2019-02-15 19:42:53.136709200 
+0100
+@@ -251,12 +251,6 @@
+                 } else
+                     _setmode(fd, _O_BINARY);
+             }
+-#  elif defined(OPENSSL_SYS_WIN32_CYGWIN)
+-            int fd = fileno((FILE *)ptr);
+-            if (num & BIO_FP_TEXT)
+-                setmode(fd, O_TEXT);
+-            else
+-                setmode(fd, O_BINARY);
+ #  endif
+         }
+         break;
+--- openssl-1.1.1a/Configurations/unix-Makefile.tmpl.orig      2019-02-15 
19:47:36.464755100 +0100
++++ openssl-1.1.1a/Configurations/unix-Makefile.tmpl   2019-02-15 
19:47:42.605379700 +0100
+@@ -650,7 +650,7 @@
+               : {- output_off() unless windowsdll(); "" -}; \
+               $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
+               cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
+-              chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
++              chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
+               mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
+                     $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
+               : {- output_on() unless windowsdll(); "" -}{- output_off() if 
windowsdll(); "" -}; \

diff --git a/dev-libs/openssl/openssl-1.1.1a-r1.ebuild 
b/dev-libs/openssl/openssl-1.1.1a-r1.ebuild
index 7e5e38380f..a6f6e713e2 100644
--- a/dev-libs/openssl/openssl-1.1.1a-r1.ebuild
+++ b/dev-libs/openssl/openssl-1.1.1a-r1.ebuild
@@ -37,6 +37,7 @@ PATCHES=(
        
"${FILESDIR}"/${P}-preserve-system-error-number-in-a-few-more-places.patch
        "${FILESDIR}"/${P}-fix-a-minor-nit-in-hkdflabel-size.patch
        "${FILESDIR}"/${P}-fix-cert-with-rsa-instead-of-rsaEncryption.patch
+       "${FILESDIR}"/${P}-cygwin-binmode.patch
 )
 
 # This does not copy the entire Fedora patchset, but JUST the parts that
@@ -95,8 +96,6 @@ src_prepare() {
                if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; 
then
                        [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
                fi
-               # for Cygwin, https://github.com/openssl/openssl/pull/8226
-               sed -i -e '/chmod 644 .*bin/s/644/755/' 
Configurations/unix-Makefile.tmpl || die
        fi
 
        eapply_user #332661
@@ -138,7 +137,6 @@ src_prepare() {
                        -e '/^$config{dirs}/s@ "test",@@' \
                        -i Configure || die
        fi
-
        # The config script does stupid stuff to prompt the user.  Kill it.
        sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
        ./config --test-sanity || die "I AM NOT SANE"

Reply via email to