Skip to content

Commit

Permalink
Add OpenSSL wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Jul 18, 2021
1 parent 77e7b5a commit 87344a6
Show file tree
Hide file tree
Showing 1,063 changed files with 1,467,311 additions and 0 deletions.
8 changes: 8 additions & 0 deletions releases.json
Expand Up @@ -695,6 +695,14 @@
"1.7.0-1"
]
},
"openssl": {
"dependency_names": [
"openssl"
],
"versions": [
"1.1.1k-1"
]
},
"pcg": {
"versions": [
"0.98.1-2",
Expand Down
9 changes: 9 additions & 0 deletions subprojects/openssl.wrap
@@ -0,0 +1,9 @@
[wrap-file]
directory = openssl-1.1.1k
source_url = https://www.openssl.org/source/openssl-1.1.1k.tar.gz
source_filename = openssl-1.1.1k.tar.gz
source_hash = 892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
patch_directory = openssl

[provide]
openssl = openssl_dep
19 changes: 19 additions & 0 deletions subprojects/packagefiles/openssl/LICENSE.build
@@ -0,0 +1,19 @@
Copyright (c) 2018 The Meson development team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions subprojects/packagefiles/openssl/README.md
@@ -0,0 +1,23 @@
# OpenSSL for Meson

## How this works?
TL;DR: this wrap abuses OpenSSL build system within Node.js.

Node.js has OpenSSL built-in with additional scripting around it to generate configs for GYP build system and thus bypass OpenSSL's native build system.

This wrap abuses that feature by replacing bundled OpenSSL with upstream version, patching mentioned mechanism to also generate a bunch of `meson.build` files for different platforms and uses top-level `meson.build` to wire everything together.

During installation unmodified Node.js tarball will be downloaded, its bundled OpenSSL will be replaced with upstream version and patched with `meson.build` files, enabling ability to build OpenSSL with Meson 🎉.

## How to update to newer release
Unless Node.js changes the mechanism we abuse above (unlikely, but possible, please check the diff between corresponding versions), `update-build-files.sh` file can be used.

Just update OpenSSL version in wrap file, update Node.js version in `update-build-files.sh` file to such that contains matching OpenSSL version bundled with it and run `update-build-files.sh` from the root of the repository:
```
subprojects/packagefiles/openssl/update-build-files.sh
```

Generated files in `config` directory will be added to Git automatically.

## Acknowledgement
This OpenSSL port wouldn't be possible without [Node.js project](https://github.com/nodejs/node) under [MIT license](https://github.com/nodejs/node/blob/master/LICENSE), whose OpenSSL build system was decomposed and heavily refactored.
39 changes: 39 additions & 0 deletions subprojects/packagefiles/openssl/generate_gypi.pl.patch
@@ -0,0 +1,39 @@
diff --git a/openssl/config/generate_gypi.pl b/openssl/config/generate_gypi.pl
--- a/openssl/config/generate_gypi.pl
+++ b/openssl/config/generate_gypi.pl
@@ -171,7 +171,34 @@
print CLGYPI "$clgypi";
close(CLGYPI);

+# Create meson.build
+my $mtemplate =
+ Text::Template->new(TYPE => 'FILE',
+ SOURCE => 'meson.build.tmpl',
+ DELIMITERS => [ "%%-", "-%%" ]
+ );
+
+my $meson = $mtemplate->fill_in(
+ HASH => {
+ libssl_srcs => \@libssl_srcs,
+ libcrypto_srcs => \@libcrypto_srcs,
+ generated_srcs => \@generated_srcs,
+ apps_openssl_srcs => \@apps_openssl_srcs,
+ libapps_srcs => \@libapps_srcs,
+ config => \%config,
+ target => \%target,
+ cflags => \@cflags,
+ asm => \$asm,
+ arch => \$arch,
+ lib_cppflags => \@lib_cppflags,
+ is_win => \$is_win,
+ });
+
+open(MESON, "> ./archs/$arch/$asm/meson.build");
+print MESON "$meson";
+close(MESON);
+
# Clean Up
my $cmd2 ="cd $src_dir; make -f $makefile clean; make -f $makefile distclean;" .
- "git clean -f $src_dir/crypto";
+ "git clean -f crypto";
system($cmd2) == 0 or die "Error in system($cmd2)";

0 comments on commit 87344a6

Please sign in to comment.