diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-06-09 18:29:15 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-06-12 23:44:47 +0530 |
commit | 7b3dd464eb4aedc2f37b7271d47b7f911df8ba80 (patch) | |
tree | de05f07fe5a835efe8f5c4568782fc4ae6c42667 /recipes/openssl | |
parent | 63abc835a83fcd4f1b066df548364e3d9c5f9a3e (diff) |
openssl.recipe: Add support for building with MSVC
Supports both regular Win32 and WinRT/UWP.
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/505>
Diffstat (limited to 'recipes/openssl')
3 files changed, 157 insertions, 0 deletions
diff --git a/recipes/openssl/0001-windows-makefile.tmpl-Generate-and-install-pkgconfig.patch b/recipes/openssl/0001-windows-makefile.tmpl-Generate-and-install-pkgconfig.patch new file mode 100644 index 00000000..723dd2d1 --- /dev/null +++ b/recipes/openssl/0001-windows-makefile.tmpl-Generate-and-install-pkgconfig.patch @@ -0,0 +1,95 @@ +From 96881a7b26d569b08dc5847204856ebb5fc532f9 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Tue, 9 Jun 2020 15:14:32 +0530 +Subject: [PATCH] windows-makefile.tmpl: Generate and install pkgconfig files + +Copied from unix-makefile.tmpl +--- + Configurations/windows-makefile.tmpl | 50 +++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl +index 8ef70b8..bc1e199 100644 +--- a/Configurations/windows-makefile.tmpl ++++ b/Configurations/windows-makefile.tmpl +@@ -314,7 +314,7 @@ PROCESSOR= {- $config{processor} -} + {- dependmagic('build_programs'); -}: build_programs_nodep + + build_generated: $(GENERATED_MANDATORY) +-build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -} ++build_libs_nodep: libcrypto.pc libssl.pc openssl.pc $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -} + build_engines_nodep: $(ENGINES) + build_programs_nodep: $(PROGRAMS) $(SCRIPTS) + +@@ -371,6 +371,7 @@ clean: libclean + -del /Q /S /F engines\*.lib engines\*.exp + -del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp + -del /Q /S /F test\*.exp ++ -del /Q /S /F openssl.pc libcrypto.pc libssl.pc + -rmdir /Q /S test\test-runs + + distclean: clean +@@ -426,6 +427,14 @@ install_dev: install_runtime_libs + @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" + @if "$(SHLIBS)"=="" \ + "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" ++ @ : {- output_on() if $disabled{shared}; "" -} ++ @$(PERL) $(SRCDIR)\util\mkdir-p.pl "$(DESTDIR)$(libdir)\pkgconfig" ++ @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)\pkgconfig\libcrypto.pc" ++ @"$(PERL)" "$(SRCDIR)\util\copy.pl" libcrypto.pc "$(DESTDIR)$(libdir)\pkgconfig" ++ @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)\pkgconfig\libssl.pc" ++ @"$(PERL)" "$(SRCDIR)\util\copy.pl" libssl.pc "$(DESTDIR)$(libdir)\pkgconfig" ++ @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)\pkgconfig\openssl.pc" ++ @"$(PERL)" "$(SRCDIR)\util\copy.pl" openssl.pc "$(DESTDIR)$(libdir)\pkgconfig" + + uninstall_dev: + +@@ -472,6 +481,45 @@ install_html_docs: + uninstall_html_docs: + + # Building targets ################################################### ++# ++libcrypto.pc libssl.pc openssl.pc: configdata.pm ++libcrypto.pc: ++ @$(ECHO) "prefix=$(INSTALLTOP)" > libcrypto.pc ++ @$(ECHO) "exec_prefix=$${prefix}" >> libcrypto.pc ++ @$(ECHO) "libdir=$${exec_prefix}/$(LIBDIR)" >> libcrypto.pc ++ @$(ECHO) "includedir=$${prefix}/include" >> libcrypto.pc ++ @$(ECHO) "enginesdir=$${libdir}/engines-{- $sover_dirname -}" >> libcrypto.pc ++ @$(ECHO) "" >> libcrypto.pc ++ @$(ECHO) "Name: OpenSSL-libcrypto" >> libcrypto.pc ++ @$(ECHO) "Description: OpenSSL cryptography library" >> libcrypto.pc ++ @$(ECHO) "Version: $(VERSION)" >> libcrypto.pc ++ @$(ECHO) "Libs: -L$${libdir} -lcrypto" >> libcrypto.pc ++ @$(ECHO) "Libs.private: $(LIB_EX_LIBS)" >> libcrypto.pc ++ @$(ECHO) "Cflags: -I$${includedir}" >> libcrypto.pc ++ ++libssl.pc: ++ @$(ECHO) "prefix=$(INSTALLTOP)" > libssl.pc ++ @$(ECHO) "exec_prefix=$${prefix}" >> libssl.pc ++ @$(ECHO) "libdir=$${exec_prefix}/$(LIBDIR)" >> libssl.pc ++ @$(ECHO) "includedir=$${prefix}/include" >> libssl.pc ++ @$(ECHO) "" >> libssl.pc ++ @$(ECHO) "Name: OpenSSL-libssl" >> libssl.pc ++ @$(ECHO) "Description: Secure Sockets Layer and cryptography libraries" >> libssl.pc ++ @$(ECHO) "Version: $(VERSION)" >> libssl.pc ++ @$(ECHO) "Requires.private: libcrypto" >> libssl.pc ++ @$(ECHO) "Libs: -L$${libdir} -lssl" >> libssl.pc ++ @$(ECHO) "Cflags: -I$${includedir}" >> libssl.pc ++ ++openssl.pc: ++ @$(ECHO) "prefix=$(INSTALLTOP)" > openssl.pc ++ @$(ECHO) "exec_prefix=$${prefix}" >> openssl.pc ++ @$(ECHO) "libdir=$${exec_prefix}/$(LIBDIR)" >> openssl.pc ++ @$(ECHO) "includedir=$${prefix}/include" >> openssl.pc ++ @$(ECHO) "" >> openssl.pc ++ @$(ECHO) "Name: OpenSSL" >> openssl.pc ++ @$(ECHO) "Description: Secure Sockets Layer and cryptography libraries and tools" >> openssl.pc ++ @$(ECHO) "Version: $(VERSION)" >> openssl.pc ++ @$(ECHO) "Requires: libssl libcrypto" >> openssl.pc + + configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} + @$(ECHO) "Detected changed: $?" +-- +2.27.0.windows.1 + diff --git a/recipes/openssl/0002-windows-makefile.tmpl-Fix-ONECORE-build.patch b/recipes/openssl/0002-windows-makefile.tmpl-Fix-ONECORE-build.patch new file mode 100644 index 00000000..8a254fc5 --- /dev/null +++ b/recipes/openssl/0002-windows-makefile.tmpl-Fix-ONECORE-build.patch @@ -0,0 +1,34 @@ +From 5c5959292e59650051418a7db487ac07ef701700 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Tue, 9 Jun 2020 18:21:10 +0530 +Subject: [PATCH 2/3] windows-makefile.tmpl: Fix ONECORE build + +setargv.obj is not buildable: + +``` + link /nologo /debug /subsystem:console /opt:ref /NODEFAULTLIB:kernel32.lib /nologo /debug /out:apps\openssl.exe @C:/Users/nirbheek/AppData/Local/Temp\nm76E2.tmp +LINK : fatal error LNK1181: cannot open input file 'setargv.obj' +NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\link.EXE"' : return code '0x49d' +Stop. +NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\nmake.exe"' : return code '0x2' +Stop. +``` +--- + Configurations/windows-makefile.tmpl | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl +index ca05fa4..e573f58 100644 +--- a/Configurations/windows-makefile.tmpl ++++ b/Configurations/windows-makefile.tmpl +@@ -752,7 +752,6 @@ $bin$exeext: $deps + IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest + \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<< + $objs +-setargv.obj + $linklibs\$(BIN_EX_LIBS) + << + IF EXIST $bin$exeext.manifest \\ +-- +2.27.0.windows.1 + diff --git a/recipes/openssl/0003-windows-makefile.tmpl-Do-not-prefix-import-libraries.patch b/recipes/openssl/0003-windows-makefile.tmpl-Do-not-prefix-import-libraries.patch new file mode 100644 index 00000000..8dbc3dc7 --- /dev/null +++ b/recipes/openssl/0003-windows-makefile.tmpl-Do-not-prefix-import-libraries.patch @@ -0,0 +1,28 @@ +From 1802e7c87fd9a6ba76e04b32ba258079ee94b2d4 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Tue, 9 Jun 2020 18:55:35 +0530 +Subject: [PATCH 3/3] windows-makefile.tmpl: Do not prefix import libraries + with 'lib' + +We want ssl.lib and crypto.lib, which matches libssl.dll.a and +libcrypto.dll.a since all of them can be found by GCC with -lfoo +--- + Configurations/windows-makefile.tmpl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl +index e573f58..c70f821 100644 +--- a/Configurations/windows-makefile.tmpl ++++ b/Configurations/windows-makefile.tmpl +@@ -48,7 +48,7 @@ + sub shlib_import { + my $lib = shift; + return () if $disabled{shared} || $lib =~ /\.a$/; +- return $lib . $shlibextimport; ++ return substr($lib, 3) . $shlibextimport; + } + + sub dso { +-- +2.27.0.windows.1 + |