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
38ca2633
Commit
38ca2633
authored
Dec 30, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Simplify the code for finding the various build tools.
parent
76ac103b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
58 deletions
+28
-58
build.h
tools/winebuild/build.h
+1
-1
res32.c
tools/winebuild/res32.c
+2
-1
utils.c
tools/winebuild/utils.c
+25
-56
No files found.
tools/winebuild/build.h
View file @
38ca2633
...
...
@@ -209,10 +209,10 @@ extern void warning( const char *msg, ... )
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
int
output
(
const
char
*
format
,
...
)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
char
*
find_tool
(
const
char
*
name
,
const
char
*
const
*
names
);
extern
const
char
*
get_as_command
(
void
);
extern
const
char
*
get_ld_command
(
void
);
extern
const
char
*
get_nm_command
(
void
);
extern
const
char
*
get_windres_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/res32.c
View file @
38ca2633
...
...
@@ -652,13 +652,14 @@ void output_res_o_file( DLLSPEC *spec )
if
(
res_file
)
{
c
onst
char
*
prog
=
get_windres_command
(
);
c
har
*
prog
=
find_tool
(
"windres"
,
NULL
);
char
*
cmd
=
xmalloc
(
strlen
(
prog
)
+
strlen
(
res_file
)
+
strlen
(
output_file_name
)
+
9
);
sprintf
(
cmd
,
"%s -i %s -o %s"
,
prog
,
res_file
,
output_file_name
);
if
(
verbose
)
fprintf
(
stderr
,
"%s
\n
"
,
cmd
);
err
=
system
(
cmd
);
if
(
err
)
fatal_error
(
"%s failed with status %d
\n
"
,
prog
,
err
);
free
(
cmd
);
free
(
prog
);
}
output_file_name
=
NULL
;
/* so we don't try to assemble it */
}
tools/winebuild/utils.c
View file @
38ca2633
...
...
@@ -199,15 +199,25 @@ int output( const char *format, ... )
}
/* find a build tool in the path, trying the various names */
static
char
*
find_tool
(
const
char
*
const
*
names
)
char
*
find_tool
(
const
char
*
name
,
const
char
*
const
*
names
)
{
static
char
**
dirs
;
static
unsigned
int
count
,
maxlen
;
char
*
p
,
*
file
;
const
char
*
alt_names
[
2
];
unsigned
int
i
,
len
;
struct
stat
st
;
if
(
target_alias
)
{
file
=
xmalloc
(
strlen
(
target_alias
)
+
strlen
(
name
)
+
2
);
strcpy
(
file
,
target_alias
);
strcat
(
file
,
"-"
);
strcat
(
file
,
name
);
return
file
;
}
if
(
!
dirs
)
{
char
*
path
;
...
...
@@ -230,6 +240,13 @@ static char *find_tool( const char * const *names )
for
(
i
=
0
;
i
<
count
;
i
++
)
maxlen
=
max
(
maxlen
,
strlen
(
dirs
[
i
])
+
2
);
}
if
(
!
names
)
{
alt_names
[
0
]
=
name
;
alt_names
[
1
]
=
NULL
;
names
=
alt_names
;
}
while
(
*
names
)
{
len
=
strlen
(
*
names
)
+
sizeof
(
EXEEXT
)
+
1
;
...
...
@@ -249,24 +266,15 @@ static char *find_tool( const char * const *names )
free
(
file
);
names
++
;
}
return
NULL
;
return
xstrdup
(
name
)
;
}
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
{
static
const
char
*
const
commands
[]
=
{
"gas"
,
"as"
,
NULL
};
if
(
!
(
as_command
=
find_tool
(
commands
)))
as_command
=
xstrdup
(
"as"
);
}
static
const
char
*
const
commands
[]
=
{
"gas"
,
"as"
,
NULL
};
as_command
=
find_tool
(
"as"
,
commands
);
if
(
force_pointer_size
)
{
...
...
@@ -284,17 +292,8 @@ 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
{
static
const
char
*
const
commands
[]
=
{
"ld"
,
"gld"
,
NULL
};
if
(
!
(
ld_command
=
find_tool
(
commands
)))
ld_command
=
xstrdup
(
"ld"
);
}
static
const
char
*
const
commands
[]
=
{
"ld"
,
"gld"
,
NULL
};
ld_command
=
find_tool
(
"ld"
,
commands
);
if
(
force_pointer_size
)
{
...
...
@@ -323,42 +322,12 @@ 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
{
static
const
char
*
const
commands
[]
=
{
"nm"
,
"gnm"
,
NULL
};
if
(
!
(
nm_command
=
find_tool
(
commands
)))
nm_command
=
xstrdup
(
"nm"
);
}
static
const
char
*
const
commands
[]
=
{
"nm"
,
"gnm"
,
NULL
};
nm_command
=
find_tool
(
"nm"
,
commands
);
}
return
nm_command
;
}
const
char
*
get_windres_command
(
void
)
{
static
char
*
windres_command
;
if
(
!
windres_command
)
{
if
(
target_alias
)
{
windres_command
=
xmalloc
(
strlen
(
target_alias
)
+
sizeof
(
"-windres"
)
);
strcpy
(
windres_command
,
target_alias
);
strcat
(
windres_command
,
"-windres"
);
}
else
{
static
const
char
*
const
commands
[]
=
{
"windres"
,
NULL
};
if
(
!
(
windres_command
=
find_tool
(
commands
)))
windres_command
=
xstrdup
(
"windres"
);
}
}
return
windres_command
;
}
/* get a name for a temp file, automatically cleaned up on exit */
char
*
get_temp_file_name
(
const
char
*
prefix
,
const
char
*
suffix
)
{
...
...
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