Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
aa0572f0
Commit
aa0572f0
authored
Mar 04, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Open the output file only when needed.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
87917df8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
32 deletions
+51
-32
build.h
tools/winebuild/build.h
+2
-0
import.c
tools/winebuild/import.c
+0
-3
main.c
tools/winebuild/main.c
+7
-27
res32.c
tools/winebuild/res32.c
+0
-2
spec16.c
tools/winebuild/spec16.c
+2
-0
spec32.c
tools/winebuild/spec32.c
+2
-0
utils.c
tools/winebuild/utils.c
+38
-0
No files found.
tools/winebuild/build.h
View file @
aa0572f0
...
...
@@ -258,6 +258,8 @@ extern char *get_temp_file_name( const char *prefix, const char *suffix );
extern
void
output_standard_file_header
(
void
);
extern
FILE
*
open_input_file
(
const
char
*
srcdir
,
const
char
*
name
);
extern
void
close_input_file
(
FILE
*
file
);
extern
void
open_output_file
(
void
);
extern
void
close_output_file
(
void
);
extern
void
dump_bytes
(
const
void
*
buffer
,
unsigned
int
size
);
extern
int
remove_stdcall_decoration
(
char
*
name
);
extern
void
assemble_file
(
const
char
*
src_file
,
const
char
*
obj_file
);
...
...
tools/winebuild/import.c
View file @
aa0572f0
...
...
@@ -1382,12 +1382,10 @@ static void build_windows_import_lib( DLLSPEC *spec )
const
char
*
as_flags
,
*
m_flag
;
def_file
=
get_temp_file_name
(
output_file_name
,
".def"
);
fclose
(
output_file
);
if
(
!
(
output_file
=
fopen
(
def_file
,
"w"
)))
fatal_error
(
"Unable to create output file '%s'
\n
"
,
def_file
);
output_def_file
(
spec
,
0
);
fclose
(
output_file
);
output_file
=
NULL
;
args
=
find_tool
(
"dlltool"
,
NULL
);
switch
(
target_cpu
)
...
...
@@ -1484,5 +1482,4 @@ void output_import_lib( DLLSPEC *spec, char **argv )
build_unix_import_lib
(
spec
);
build_library
(
output_file_name
,
argv
,
1
);
}
output_file_name
=
NULL
;
}
tools/winebuild/main.c
View file @
aa0572f0
...
...
@@ -79,7 +79,6 @@ char *input_file_name = NULL;
char
*
spec_file_name
=
NULL
;
FILE
*
output_file
=
NULL
;
const
char
*
output_file_name
=
NULL
;
static
const
char
*
output_file_source_name
;
static
int
fake_module
;
struct
strarray
lib_path
=
{
0
};
...
...
@@ -450,25 +449,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
add_import_dll
(
optarg
,
NULL
);
break
;
case
'o'
:
{
char
*
ext
=
strrchr
(
optarg
,
'.'
);
if
(
unlink
(
optarg
)
==
-
1
&&
errno
!=
ENOENT
)
fatal_error
(
"Unable to create output file '%s'
\n
"
,
optarg
);
if
(
ext
&&
!
strcmp
(
ext
,
".o"
))
{
output_file_source_name
=
get_temp_file_name
(
optarg
,
".s"
);
if
(
!
(
output_file
=
fopen
(
output_file_source_name
,
"w"
)))
fatal_error
(
"Unable to create output file '%s'
\n
"
,
optarg
);
}
else
{
if
(
!
(
output_file
=
fopen
(
optarg
,
"w"
)))
fatal_error
(
"Unable to create output file '%s'
\n
"
,
optarg
);
}
output_file_name
=
xstrdup
(
optarg
);
atexit
(
cleanup
);
/* make sure we remove the output file on exit */
}
if
(
unlink
(
optarg
)
==
-
1
&&
errno
!=
ENOENT
)
fatal_error
(
"Unable to create output file '%s'
\n
"
,
optarg
);
output_file_name
=
xstrdup
(
optarg
);
break
;
case
'r'
:
strarray_add
(
&
res_files
,
xstrdup
(
optarg
),
NULL
);
...
...
@@ -636,8 +619,8 @@ int main(int argc, char **argv)
signal
(
SIGTERM
,
exit_on_signal
);
signal
(
SIGINT
,
exit_on_signal
);
output_file
=
stdout
;
argv
=
parse_options
(
argc
,
argv
,
spec
);
atexit
(
cleanup
);
/* make sure we remove the output file on exit */
switch
(
exec_mode
)
{
...
...
@@ -671,7 +654,9 @@ int main(int argc, char **argv)
if
(
argv
[
0
])
fatal_error
(
"file argument '%s' not allowed in this mode
\n
"
,
argv
[
0
]
);
if
(
!
spec_file_name
)
fatal_error
(
"missing .spec file
\n
"
);
if
(
!
parse_input_file
(
spec
))
break
;
open_output_file
();
output_def_file
(
spec
,
1
);
close_output_file
();
break
;
case
MODE_IMPLIB
:
if
(
!
spec_file_name
)
fatal_error
(
"missing .spec file
\n
"
);
...
...
@@ -687,11 +672,6 @@ int main(int argc, char **argv)
break
;
}
if
(
nb_errors
)
exit
(
1
);
if
(
output_file_name
)
{
if
(
fclose
(
output_file
)
<
0
)
fatal_perror
(
"fclose"
);
if
(
output_file_source_name
)
assemble_file
(
output_file_source_name
,
output_file_name
);
output_file_name
=
NULL
;
}
output_file_name
=
NULL
;
return
0
;
}
tools/winebuild/res32.c
View file @
aa0572f0
...
...
@@ -698,6 +698,4 @@ void output_res_o_file( DLLSPEC *spec )
if
(
format
)
strarray_add
(
&
args
,
"-F"
,
format
,
NULL
);
spawn
(
args
);
output_file_name
=
NULL
;
/* so we don't try to assemble it */
}
tools/winebuild/spec16.c
View file @
aa0572f0
...
...
@@ -816,6 +816,7 @@ void output_spec16_file( DLLSPEC *spec16 )
add_16bit_exports
(
spec32
,
spec16
);
needs_get_pc_thunk
=
0
;
open_output_file
();
output_standard_file_header
();
output_module
(
spec32
);
output_module16
(
spec16
);
...
...
@@ -831,6 +832,7 @@ void output_spec16_file( DLLSPEC *spec16 )
output
(
"
\t
%s
\"
%s
\"\n
"
,
get_asm_string_keyword
(),
spec16
->
main_module
);
}
output_gnu_stack_note
();
close_output_file
();
free_dll_spec
(
spec32
);
}
...
...
tools/winebuild/spec32.c
View file @
aa0572f0
...
...
@@ -703,6 +703,7 @@ void BuildSpec32File( DLLSPEC *spec )
{
needs_get_pc_thunk
=
0
;
resolve_imports
(
spec
);
open_output_file
();
output_standard_file_header
();
output_module
(
spec
);
output_stubs
(
spec
);
...
...
@@ -711,6 +712,7 @@ void BuildSpec32File( DLLSPEC *spec )
if
(
needs_get_pc_thunk
)
output_get_pc_thunk
();
output_resources
(
spec
);
output_gnu_stack_note
();
close_output_file
();
}
...
...
tools/winebuild/utils.c
View file @
aa0572f0
...
...
@@ -47,6 +47,7 @@
static
struct
strarray
tmp_files
;
static
struct
strarray
empty_strarray
;
static
const
char
*
output_file_source_name
;
static
const
struct
{
...
...
@@ -564,8 +565,10 @@ void init_output_buffer(void)
void
flush_output_buffer
(
void
)
{
open_output_file
();
if
(
fwrite
(
output_buffer
,
1
,
output_buffer_pos
,
output_file
)
!=
output_buffer_pos
)
fatal_error
(
"Error writing to %s
\n
"
,
output_file_name
);
close_output_file
();
free
(
output_buffer
);
}
...
...
@@ -724,6 +727,41 @@ void close_input_file( FILE *file )
/*******************************************************************
* open_output_file
*/
void
open_output_file
(
void
)
{
if
(
output_file_name
)
{
if
(
strendswith
(
output_file_name
,
".o"
))
{
output_file_source_name
=
get_temp_file_name
(
output_file_name
,
".s"
);
if
(
!
(
output_file
=
fopen
(
output_file_source_name
,
"w"
)))
fatal_error
(
"Unable to create output file '%s'
\n
"
,
output_file_name
);
}
else
{
if
(
!
(
output_file
=
fopen
(
output_file_name
,
"w"
)))
fatal_error
(
"Unable to create output file '%s'
\n
"
,
output_file_name
);
}
}
else
output_file
=
stdout
;
}
/*******************************************************************
* close_output_file
*/
void
close_output_file
(
void
)
{
if
(
!
output_file
||
!
output_file_name
)
return
;
if
(
fclose
(
output_file
)
<
0
)
fatal_perror
(
"fclose"
);
if
(
output_file_source_name
)
assemble_file
(
output_file_source_name
,
output_file_name
);
output_file
=
NULL
;
}
/*******************************************************************
* remove_stdcall_decoration
*
* Remove a possible @xx suffix from a function name.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment