freebsd-ports/graphics/gd/files/patch-bdftogd
2017-01-29 09:49:50 +00:00

68 lines
1.2 KiB
Text

--- src/bdftogd.orig 2017-01-29 09:45:57 UTC
+++ src/bdftogd
@@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname
my $filename = shift;
$filename = 'gd' . $filename unless $filename =~ /^gd/i;
+my $gdfunc = $gdname;
+$gdfunc =~ s/(.*Font)(.*)/$1Get$2/;
+
if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; }
if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; }
@@ -139,6 +142,10 @@ print FILEC <<"EOF";
$info
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "$filename.h"
char ${gdname}Data[] = {
@@ -177,28 +184,40 @@ gdFont ${gdname}Rep = {
${gdname}Data
};
-gdFontPtr ${gdname} = &${gdname}Rep;
+BGD_EXPORT_DATA_PROT gdFontPtr ${gdname} = &${gdname}Rep;
-/* This file has not been truncated. */
+BGD_DECLARE(gdFontPtr)
+$gdfunc (void)
+{
+ return $gdname;
+}
+/* This file has not been truncated. */
EOF
close FILEC;
print FILEH <<"EOF";
-
#ifndef $capdef
#define $capdef 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
$info
#include "gd.h"
-extern gdFontPtr $gdname;
+extern BGD_EXPORT_DATA_PROT gdFontPtr $gdname;
+BGD_DECLARE(gdFontPtr) $gdfunc(void);
+#ifdef __cplusplus
+}
#endif
+#endif
EOF
1;