Resurrect and modernize C++Builder config
authorTanzinul Islam <tanzinul.islam@gmail.com>
Thu, 19 Nov 2020 23:39:12 +0000 (23:39 +0000)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 19 Apr 2021 09:05:54 +0000 (11:05 +0200)
Similar configuration to what was deleted in 8e56a422, updated for the
unified build scheme. Use the [Clang-based `bcc32c.exe`][1] to avoid a
[bug][2] with the old one, and increase the `tlib.exe` page size to 256.
Also avoid MSVC-specific C runtime library functions.

[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Win32_Clang-enhanced_Compilers
[2]: https://quality.embarcadero.com/browse/RSP-31630

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)

.gitignore
Configurations/50-cppbuilder.conf [new file with mode: 0644]
crypto/conf/conf_sap.c
crypto/init.c

index 7a0745010604327e4bfce9ee0fc87d4feda53be2..b88ede1d59d38fa9e9f94995523b5f274b3bd976 100644 (file)
@@ -212,6 +212,7 @@ providers/common/include/prov/der_sm2.h
 *.exp
 *.lib
 *.pdb
+*.tds
 *.ilk
 *.def
 *.rc
@@ -227,6 +228,7 @@ cscope.*
 *.d
 *.d.tmp
 pod2htmd.tmp
+MAKE0[0-9][0-9][0-9].@@@
 
 # Windows manifest files
 *.manifest
diff --git a/Configurations/50-cppbuilder.conf b/Configurations/50-cppbuilder.conf
new file mode 100644 (file)
index 0000000..b8ecfdc
--- /dev/null
@@ -0,0 +1,37 @@
+my %targets = (
+    "BC-32" => {
+        inherit_from     => [ "BASE_Windows" ],
+        sys_id           => "WIN32",
+        bn_ops           => "BN_LLONG",
+        dso_scheme       => "win32",
+        thread_scheme    => "winthreads",
+        cc               => "bcc32c",
+        defines          => add("WIN32_LEAN_AND_MEAN", "OPENSSL_SYS_WIN32",
+                                "L_ENDIAN", "DSO_WIN32", "_stricmp=stricmp",
+                                "_strnicmp=strnicmp", "_malloca=malloc",
+                                "_freea=free", "_setmode=setmode"),
+        cflags           => picker(default => "-q -c -tWC -tWM",
+                                   debug   => "-Od -v -vi- -D_DEBUG",
+                                   release => "-O2"),
+        coutflag         => "-o",
+        LD               => "ilink32",
+        lflags           => picker(default => "-ap -Tpe -x -Gn -q",
+                                   debug   => '-j"$(BDS)\lib\win32c\debug" ' .
+                                              '-L"$(BDS)\lib\win32c\debug"',
+                                   release => '-j"$(BDS)\lib\win32c\release" ' .
+                                              '-L"$(BDS)\lib\win32c\release"'),
+        ldoutflag        => ",",
+        ldpostoutflag    => ",,",
+        ld_resp_delim    => " +\n",
+        ld_wildcard_args => "wildargs.obj",
+        ex_libs          => add(sub {
+            my @ex_libs = ();
+            push @ex_libs, ("cw32mt.lib", "import32.lib", "crypt32.lib",
+                            "ws2_32.lib") unless $disabled{sock};
+            return join(" ", @ex_libs);
+        }),
+        AR               => "tlib",
+        ARFLAGS          => "/P256 /N /u",
+        ar_resp_delim    => " &\n",
+    }
+);
index 4188f9113ade4ddf4e2f0a96a1e52911002f03c0..5cd018c1678908f954a2ab6c6e584c88067d9205 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/asn1.h>
 #include <openssl/engine.h>
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
 # define strdup _strdup
 #endif
 
index bf5c17da6d23c03624ee3cdbb6177a3e79eda5b7..788abe52e8757b083ae910c9401d885ae53fe552 100644 (file)
@@ -89,7 +89,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_register_atexit)
     fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
 #endif
 #ifndef OPENSSL_SYS_UEFI
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__BORLANDC__)
     /* We use _onexit() in preference because it gets called on DLL unload */
     if (_onexit(win32atexit) == NULL)
         return 0;