Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
d07f67ac
Commit
d07f67ac
authored
Feb 04, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Determine the appropriate as/ld/nm commands at the time they are needed.
parent
63abc124
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
30 deletions
+72
-30
build.h
tools/winebuild/build.h
+4
-0
import.c
tools/winebuild/import.c
+7
-7
main.c
tools/winebuild/main.c
+3
-19
utils.c
tools/winebuild/utils.c
+58
-4
No files found.
tools/winebuild/build.h
View file @
d07f67ac
...
...
@@ -119,6 +119,7 @@ enum target_platform
PLATFORM_UNSPECIFIED
,
PLATFORM_APPLE
,
PLATFORM_SOLARIS
,
PLATFORM_WINDOWS
};
extern
char
*
target_alias
;
extern
enum
target_cpu
target_cpu
;
extern
enum
target_platform
target_platform
;
...
...
@@ -168,6 +169,9 @@ extern void warning( const char *msg, ... )
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
int
output
(
const
char
*
format
,
...
)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
const
char
*
get_as_command
(
void
);
extern
const
char
*
get_ld_command
(
void
);
extern
const
char
*
get_nm_command
(
void
);
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
);
...
...
tools/winebuild/import.c
View file @
d07f67ac
...
...
@@ -527,21 +527,21 @@ static char *create_undef_symbols_file( DLLSPEC *spec )
static
const
char
*
ldcombine_files
(
DLLSPEC
*
spec
,
char
**
argv
)
{
unsigned
int
i
,
len
=
0
;
const
char
*
prog
=
get_ld_command
();
char
*
cmd
,
*
p
,
*
ld_tmp_file
,
*
undef_file
;
int
err
;
undef_file
=
create_undef_symbols_file
(
spec
);
len
+=
strlen
(
undef_file
)
+
1
;
ld_tmp_file
=
get_temp_file_name
(
output_file_name
,
".o"
);
if
(
!
ld_command
)
ld_command
=
xstrdup
(
"ld"
);
for
(
i
=
0
;
argv
[
i
];
i
++
)
len
+=
strlen
(
argv
[
i
])
+
1
;
cmd
=
p
=
xmalloc
(
len
+
strlen
(
ld_tmp_file
)
+
8
+
strlen
(
ld_command
)
);
p
+=
sprintf
(
cmd
,
"%s -r -o %s %s"
,
ld_command
,
ld_tmp_file
,
undef_file
);
cmd
=
p
=
xmalloc
(
len
+
strlen
(
ld_tmp_file
)
+
8
+
strlen
(
prog
)
);
p
+=
sprintf
(
cmd
,
"%s -r -o %s %s"
,
prog
,
ld_tmp_file
,
undef_file
);
for
(
i
=
0
;
argv
[
i
];
i
++
)
p
+=
sprintf
(
p
,
" %s"
,
argv
[
i
]
);
if
(
verbose
)
fprintf
(
stderr
,
"%s
\n
"
,
cmd
);
err
=
system
(
cmd
);
if
(
err
)
fatal_error
(
"%s -r failed with status %d
\n
"
,
ld_command
,
err
);
if
(
err
)
fatal_error
(
"%s -r failed with status %d
\n
"
,
prog
,
err
);
free
(
cmd
);
return
ld_tmp_file
;
}
...
...
@@ -551,6 +551,7 @@ void read_undef_symbols( DLLSPEC *spec, char **argv )
{
size_t
prefix_len
;
FILE
*
f
;
const
char
*
prog
=
get_nm_command
();
char
*
cmd
,
buffer
[
1024
],
name_prefix
[
16
];
int
err
;
const
char
*
name
;
...
...
@@ -564,9 +565,8 @@ void read_undef_symbols( DLLSPEC *spec, char **argv )
name
=
ldcombine_files
(
spec
,
argv
);
if
(
!
nm_command
)
nm_command
=
xstrdup
(
"nm"
);
cmd
=
xmalloc
(
strlen
(
nm_command
)
+
strlen
(
name
)
+
5
);
sprintf
(
cmd
,
"%s -u %s"
,
nm_command
,
name
);
cmd
=
xmalloc
(
strlen
(
prog
)
+
strlen
(
name
)
+
5
);
sprintf
(
cmd
,
"%s -u %s"
,
prog
,
name
);
if
(
!
(
f
=
popen
(
cmd
,
"r"
)))
fatal_error
(
"Cannot execute '%s'
\n
"
,
cmd
);
...
...
tools/winebuild/main.c
View file @
d07f67ac
...
...
@@ -74,6 +74,7 @@ enum target_platform target_platform = PLATFORM_WINDOWS;
enum
target_platform
target_platform
=
PLATFORM_UNSPECIFIED
;
#endif
char
*
target_alias
=
NULL
;
char
**
lib_path
=
NULL
;
char
*
input_file_name
=
NULL
;
...
...
@@ -162,6 +163,8 @@ static void set_target( const char *target )
/* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
target_alias
=
xstrdup
(
target
);
/* get the CPU part */
if
(
!
(
p
=
strchr
(
spec
,
'-'
)))
fatal_error
(
"Invalid target specification '%s'
\n
"
,
target
);
...
...
@@ -184,25 +187,6 @@ static void set_target( const char *target )
}
free
(
spec
);
if
(
!
as_command
)
{
as_command
=
xmalloc
(
strlen
(
target
)
+
sizeof
(
"-as"
)
);
strcpy
(
as_command
,
target
);
strcat
(
as_command
,
"-as"
);
}
if
(
!
ld_command
)
{
ld_command
=
xmalloc
(
strlen
(
target
)
+
sizeof
(
"-ld"
)
);
strcpy
(
ld_command
,
target
);
strcat
(
ld_command
,
"-ld"
);
}
if
(
!
nm_command
)
{
nm_command
=
xmalloc
(
strlen
(
target
)
+
sizeof
(
"-nm"
)
);
strcpy
(
nm_command
,
target
);
strcat
(
nm_command
,
"-nm"
);
}
}
/* cleanup on program exit */
...
...
tools/winebuild/utils.c
View file @
d07f67ac
...
...
@@ -193,6 +193,60 @@ int output( const char *format, ... )
return
ret
;
}
const
char
*
get_as_command
(
void
)
{
if
(
!
as_command
)
{
if
(
target_alias
)
{
as_command
=
xmalloc
(
strlen
(
target_alias
)
+
sizeof
(
"-as"
)
);
strcpy
(
as_command
,
target_alias
);
strcat
(
as_command
,
"-as"
);
}
else
{
as_command
=
xstrdup
(
"as"
);
}
}
return
as_command
;
}
const
char
*
get_ld_command
(
void
)
{
if
(
!
ld_command
)
{
if
(
target_alias
)
{
ld_command
=
xmalloc
(
strlen
(
target_alias
)
+
sizeof
(
"-ld"
)
);
strcpy
(
ld_command
,
target_alias
);
strcat
(
ld_command
,
"-ld"
);
}
else
{
ld_command
=
xstrdup
(
"ld"
);
}
}
return
ld_command
;
}
const
char
*
get_nm_command
(
void
)
{
if
(
!
nm_command
)
{
if
(
target_alias
)
{
nm_command
=
xmalloc
(
strlen
(
target_alias
)
+
sizeof
(
"-nm"
)
);
strcpy
(
nm_command
,
target_alias
);
strcat
(
nm_command
,
"-nm"
);
}
else
{
nm_command
=
xstrdup
(
"nm"
);
}
}
return
nm_command
;
}
/* get a name for a temp file, automatically cleaned up on exit */
char
*
get_temp_file_name
(
const
char
*
prefix
,
const
char
*
suffix
)
{
...
...
@@ -315,15 +369,15 @@ int remove_stdcall_decoration( char *name )
*/
void
assemble_file
(
const
char
*
src_file
,
const
char
*
obj_file
)
{
const
char
*
prog
=
get_as_command
();
char
*
cmd
;
int
err
;
if
(
!
as_command
)
as_command
=
xstrdup
(
"as"
);
cmd
=
xmalloc
(
strlen
(
as_command
)
+
strlen
(
obj_file
)
+
strlen
(
src_file
)
+
6
);
sprintf
(
cmd
,
"%s -o %s %s"
,
as_command
,
obj_file
,
src_file
);
cmd
=
xmalloc
(
strlen
(
prog
)
+
strlen
(
obj_file
)
+
strlen
(
src_file
)
+
6
);
sprintf
(
cmd
,
"%s -o %s %s"
,
prog
,
obj_file
,
src_file
);
if
(
verbose
)
fprintf
(
stderr
,
"%s
\n
"
,
cmd
);
err
=
system
(
cmd
);
if
(
err
)
fatal_error
(
"%s failed with status %d
\n
"
,
as_command
,
err
);
if
(
err
)
fatal_error
(
"%s failed with status %d
\n
"
,
prog
,
err
);
free
(
cmd
);
}
...
...
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