From 0e97ef992e8ac97dd6ff50f7b35422c57ebddd21 Mon Sep 17 00:00:00 2001
From: Ilya Fedin <fedin-ilja2010@ya.ru>
Date: Mon, 27 Jun 2022 12:13:40 +0400
Subject: [PATCH] Build OpenSSL 1.1.1 in snap

---
 snap/snapcraft.yaml | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 89416f685..42b4ee0d7 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -96,7 +96,6 @@ parts:
       - libglibmm-2.4-dev
       - libopus-dev
       - libpulse-dev
-      - libssl-dev
       - libwayland-dev
       - libxcb1-dev
       - libxcb-keysyms1-dev
@@ -109,7 +108,6 @@ parts:
       - libglibmm-2.4-1v5
       - libopus0
       - libpulse0
-      - libssl3
       - libwayland-client0
       - libwebkit2gtk-4.1-0
       - libxcb1
@@ -157,6 +155,7 @@ parts:
       - ffmpeg
       - mozjpeg
       - openal
+      - openssl
       - rnnoise
       - webrtc
 
@@ -262,6 +261,27 @@ parts:
       - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig
       - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so
 
+  openssl:
+    source: https://github.com/openssl/openssl.git
+    source-depth: 1
+    source-branch: OpenSSL_1_1_1-stable
+    plugin: make
+    override-build: |
+      ./config \
+        shared \
+        --prefix=/usr \
+        --openssldir=/usr/lib/ssl \
+        --libdir=lib/$CRAFT_ARCH_TRIPLET \
+        no-tests
+      craftctl default
+    prime:
+      - -./usr/bin
+      - -./usr/include
+      - -./usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig
+      - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.a
+      - -./usr/lib/$CRAFT_ARCH_TRIPLET/*.so
+      - -./usr/share
+
   qt:
     plugin: nil
     build-packages:
@@ -279,7 +299,6 @@ parts:
       - libpcre2-dev
       - libpng-dev
       - libsm-dev
-      - libssl-dev
       - libwayland-dev
       - libx11-dev
       - libx11-xcb-dev
@@ -316,7 +335,6 @@ parts:
       - libpcre2-16-0
       - libpng16-16
       - libsm6
-      - libssl3
       - libwayland-client0
       - libwayland-cursor0
       - libwayland-egl1
@@ -385,6 +403,7 @@ parts:
       - -./usr/modules
     after:
       - mozjpeg
+      - openssl
       - patches
 
   rnnoise:
@@ -420,7 +439,6 @@ parts:
       - libopenh264-dev
       - libopus-dev
       - libpipewire-0.3-dev
-      - libssl-dev
       - libvpx-dev
       - libx11-dev
       - libxcomposite-dev
@@ -439,7 +457,6 @@ parts:
       - libopenh264-6
       - libopus0
       - libpipewire-0.3-0
-      - libssl3
       - libvpx7
       - libx11-6
       - libxcomposite1
@@ -462,3 +479,4 @@ parts:
     after:
       - ffmpeg
       - mozjpeg
+      - openssl