summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/win32/bin2coff.rules8
-rw-r--r--platform/win32/libresources.vcproj16
-rw-r--r--scripts/bin2coff.c34
3 files changed, 32 insertions, 26 deletions
diff --git a/platform/win32/bin2coff.rules b/platform/win32/bin2coff.rules
index d2ae45a3..955c9726 100644
--- a/platform/win32/bin2coff.rules
+++ b/platform/win32/bin2coff.rules
@@ -7,7 +7,7 @@
<CustomBuildRule
Name="bin2coff (ttf)"
DisplayName="bin2coff (ttf)"
- CommandLine="Release\bin2coff.exe $(InputPath) Release\libresources\$(InputName)_ttf.obj _binary_resources_fonts_$(InputName)_ttf&#x0D;&#x0A;Release\bin2coff.exe $(InputPath) x64\Release\libresources\$(InputName)_ttf.obj _binary_resources_fonts_$(InputName)_ttf 64bit&#x0D;&#x0A;&#x0D;&#x0A;"
+ CommandLine="Release\bin2coff.exe $(InputPath) $(IntDir)\$(InputName)_ttf.obj _binary_resources_fonts_$(InputName)_ttf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttf.obj"
FileExtensions="*.ttf"
ExecutionDescription="Embedding TTF"
@@ -18,7 +18,7 @@
<CustomBuildRule
Name="bin2coff (otf)"
DisplayName="bin2coff (otf)"
- CommandLine="Release\bin2coff.exe $(InputPath) Release\libresources\$(InputName)_otf.obj _binary_resources_fonts_$(InputName)_otf&#x0D;&#x0A;Release\bin2coff.exe $(InputPath) x64\Release\libresources\$(InputName)_otf.obj _binary_resources_fonts_$(InputName)_otf 64bit&#x0D;&#x0A;&#x0D;&#x0A;&#x0D;&#x0A;"
+ CommandLine="Release\bin2coff.exe $(InputPath) $(IntDir)\$(InputName)_otf.obj _binary_resources_fonts_$(InputName)_otf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_otf.obj"
FileExtensions="*.otf"
ExecutionDescription="Embedding OTF"
@@ -29,7 +29,7 @@
<CustomBuildRule
Name="bin2coff (cff)"
DisplayName="bin2coff (cff)"
- CommandLine="Release\bin2coff.exe $(InputPath) Release\libresources\$(InputName)_cff.obj _binary_resources_fonts_$(InputName)_cff&#x0D;&#x0A;Release\bin2coff.exe $(InputPath) x64\Release\libresources\$(InputName)_cff.obj _binary_resources_fonts_$(InputName)_cff 64bit&#x0D;&#x0A;&#x0D;&#x0A;&#x0D;&#x0A;"
+ CommandLine="Release\bin2coff.exe $(InputPath) $(IntDir)\$(InputName)_cff.obj _binary_resources_fonts_$(InputName)_cff $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_cff.obj"
FileExtensions="*.cff"
ExecutionDescription="Embedding CFF"
@@ -40,7 +40,7 @@
<CustomBuildRule
Name="bin2coff (ttc)"
DisplayName="bin2coff (ttc)"
- CommandLine="Release\bin2coff.exe $(InputPath) Release\libresources\$(InputName)_ttc.obj _binary_resources_fonts_$(InputName)_ttc&#x0D;&#x0A;Release\bin2coff.exe $(InputPath) x64\Release\libresources\$(InputName)_ttc.obj _binary_resources_fonts_$(InputName)_ttc 64bit&#x0D;&#x0A;&#x0D;&#x0A;&#x0D;&#x0A;"
+ CommandLine="Release\bin2coff.exe $(InputPath) $(IntDir)\$(InputName)_ttc.obj _binary_resources_fonts_$(InputName)_ttc $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttc.obj"
FileExtensions="*.ttc"
ExecutionDescription="Embedding TTC"
diff --git a/platform/win32/libresources.vcproj b/platform/win32/libresources.vcproj
index f28a51a7..30f2e36e 100644
--- a/platform/win32/libresources.vcproj
+++ b/platform/win32/libresources.vcproj
@@ -755,22 +755,6 @@
>
</File>
<File
- RelativePath="..\..\resources\fonts\urw\NimbusSansNarrow-BdOblique.cff"
- >
- </File>
- <File
- RelativePath="..\..\resources\fonts\urw\NimbusSansNarrow-Bold.cff"
- >
- </File>
- <File
- RelativePath="..\..\resources\fonts\urw\NimbusSansNarrow-Oblique.cff"
- >
- </File>
- <File
- RelativePath="..\..\resources\fonts\urw\NimbusSansNarrow-Regular.cff"
- >
- </File>
- <File
RelativePath="..\..\resources\fonts\urw\StandardSymbolsPS.cff"
>
</File>
diff --git a/scripts/bin2coff.c b/scripts/bin2coff.c
index 4a8592ac..8c8a956f 100644
--- a/scripts/bin2coff.c
+++ b/scripts/bin2coff.c
@@ -2,7 +2,7 @@
* bin2coff: converts a data object into a Win32 linkable COFF binary object
* Copyright (c) 2011 Pete Batard <pete@akeo.ie>
* This file is part of the libwdi project: http://libwdi.sf.net
- * Modified 2018 by Artifex Software to rename '-' characters to '_' in symbols.
+ * Modifications Copyright (c) 2018 by Artifex Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +27,12 @@
* http://pierrelib.pagesperso-orange.fr/exec_formats/MS_Symbol_Type_v1.0.pdf
*/
+/*
+ Updates from Artifex Software Inc.
+ + Automatically rename '-' to '_' in generated symbols.
+ + Accept 'Win32' and 'x64' as flags.
+ */
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -223,6 +229,17 @@ typedef struct {
#pragma pack(pop)
+static int check_64bit(const char *arg, int *x86_32)
+{
+ if ((strcmp(arg, "64bit") == 0) || (strcmp(arg, "x64") == 0))
+ *x86_32 = 0; /* 0 = 64bit */
+ else if ((strcmp(arg, "32bit") == 0) || (strcmp(arg, "Win32") == 0))
+ *x86_32 = 1; /* 1 = 32bit */
+ else
+ return 0;
+ return 1;
+}
+
int
#ifdef DDKBUILD
__cdecl
@@ -230,7 +247,7 @@ __cdecl
main (int argc, char *argv[])
{
const uint16_t endian_test = 0xBE00;
- int x86_32, short_label, short_size;
+ int x86_32, short_label, short_size, last_arg;
int i, r = 1;
char* label;
FILE *fd = NULL;
@@ -243,12 +260,12 @@ main (int argc, char *argv[])
SIZE_TYPE* data_size;
if ((argc < 3) || (argc > 5)) {
- fprintf(stderr, "\nUsage: bin2coff bin obj [label] [64bit]\n\n");
+ fprintf(stderr, "\nUsage: bin2coff bin obj [label] [64bit|Win32|x64]\n\n");
fprintf(stderr, " bin : source binary data\n");
fprintf(stderr, " obj : target object file, in MS COFF format.\n");
fprintf(stderr, " label: identifier for the extern data. If not provided, the name of the\n");
fprintf(stderr, " binary file without extension is used.\n");
- fprintf(stderr, " 64bit: produce a 64 bit compatible object - symbols are generated without\n");
+ fprintf(stderr, " 64bit:\n Win32:\n x64 : produce a 64 bit compatible object - symbols are generated without\n");
fprintf(stderr, " leading underscores and machine type is set to x86_x64.\n\n");
fprintf(stderr, "With your linker set properly, typical access from a C source is:\n\n");
fprintf(stderr, " extern uint8_t label[] /* binary data */\n");
@@ -271,10 +288,15 @@ main (int argc, char *argv[])
size = (size_t)ftell(fd);
fseek(fd, 0, SEEK_SET);
- x86_32 = (((argc >= 4) && (strcmp(argv[3], "64bit") == 0)) || ((argc >= 5) && (strcmp(argv[4], "64bit") == 0)))?0:1;
+ x86_32 = 0;
+ last_arg = argc;
+ if (argc >= 4 && check_64bit(argv[4], &x86_32))
+ last_arg = 4;
+ else if (argc >= 5 && check_64bit(argv[5], &x86_32))
+ last_arg = 5;
/* Label setup */
- if ( (argc < 4) || ((argc == 4) && (!x86_32)) ) {
+ if (argc < last_arg) {
for (i=(int)strlen(argv[1])-1; i>=0; i--) {
if (argv[1][i] == '.') {
argv[1][i] = 0;