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
c697ee72
Commit
c697ee72
authored
Aug 11, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegcc: Add a helper function to build the .spec.o file.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3931375
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
79 deletions
+97
-79
winegcc.c
tools/winegcc/winegcc.c
+97
-79
No files found.
tools/winegcc/winegcc.c
View file @
c697ee72
...
...
@@ -1120,10 +1120,105 @@ static void add_library( struct options *opts, strarray *lib_dirs, strarray *fil
free
(
fullname
);
}
/* run winebuild to generate the .spec.o file */
static
const
char
*
build_spec_obj
(
struct
options
*
opts
,
const
char
*
spec_file
,
const
char
*
output_file
,
strarray
*
files
,
strarray
*
lib_dirs
,
const
char
*
entry_point
)
{
unsigned
int
i
;
int
is_pe
=
is_pe_target
(
opts
);
strarray
*
spec_args
=
get_winebuild_args
(
opts
);
strarray
*
tool
;
const
char
*
spec_o_name
,
*
output_name
;
int
fake_module
=
strendswith
(
output_file
,
".fake"
);
/* get the filename from the path */
if
((
output_name
=
strrchr
(
output_file
,
'/'
)))
output_name
++
;
else
output_name
=
output_file
;
if
((
tool
=
build_tool_name
(
opts
,
TOOL_CC
)))
strarray_add
(
spec_args
,
strmake
(
"--cc-cmd=%s"
,
strarray_tostring
(
tool
,
" "
)));
if
(
!
is_pe
&&
(
tool
=
build_tool_name
(
opts
,
TOOL_LD
)))
strarray_add
(
spec_args
,
strmake
(
"--ld-cmd=%s"
,
strarray_tostring
(
tool
,
" "
)));
spec_o_name
=
get_temp_file
(
output_name
,
".spec.o"
);
if
(
opts
->
force_pointer_size
)
strarray_add
(
spec_args
,
strmake
(
"-m%u"
,
8
*
opts
->
force_pointer_size
));
if
(
opts
->
pic
&&
!
is_pe
)
strarray_add
(
spec_args
,
"-fPIC"
);
strarray_add
(
spec_args
,
opts
->
shared
?
"--dll"
:
"--exe"
);
if
(
fake_module
)
{
strarray_add
(
spec_args
,
"--fake-module"
);
strarray_add
(
spec_args
,
"-o"
);
strarray_add
(
spec_args
,
output_file
);
}
else
{
strarray_add
(
spec_args
,
"-o"
);
strarray_add
(
spec_args
,
spec_o_name
);
}
if
(
spec_file
)
{
strarray_add
(
spec_args
,
"-E"
);
strarray_add
(
spec_args
,
spec_file
);
}
if
(
!
opts
->
shared
)
{
strarray_add
(
spec_args
,
"-F"
);
strarray_add
(
spec_args
,
output_name
);
strarray_add
(
spec_args
,
"--subsystem"
);
strarray_add
(
spec_args
,
opts
->
gui_app
?
"windows"
:
"console"
);
if
(
opts
->
large_address_aware
)
strarray_add
(
spec_args
,
"--large-address-aware"
);
}
if
(
opts
->
target_platform
==
PLATFORM_WINDOWS
)
strarray_add
(
spec_args
,
"--safeseh"
);
if
(
entry_point
)
{
strarray_add
(
spec_args
,
"--entry"
);
strarray_add
(
spec_args
,
entry_point
);
}
if
(
opts
->
subsystem
)
{
strarray_add
(
spec_args
,
"--subsystem"
);
strarray_add
(
spec_args
,
opts
->
subsystem
);
}
for
(
i
=
0
;
i
<
lib_dirs
->
size
;
i
++
)
strarray_add
(
spec_args
,
strmake
(
"-L%s"
,
lib_dirs
->
base
[
i
]));
if
(
!
is_pe
)
{
for
(
i
=
0
;
i
<
opts
->
delayimports
->
size
;
i
++
)
strarray_add
(
spec_args
,
strmake
(
"-d%s"
,
opts
->
delayimports
->
base
[
i
]));
}
/* add resource files */
for
(
i
=
0
;
i
<
files
->
size
;
i
++
)
if
(
files
->
base
[
i
][
1
]
==
'r'
)
strarray_add
(
spec_args
,
files
->
base
[
i
]);
/* add other files */
strarray_add
(
spec_args
,
"--"
);
for
(
i
=
0
;
i
<
files
->
size
;
i
++
)
{
switch
(
files
->
base
[
i
][
1
])
{
case
'd'
:
case
'a'
:
case
'o'
:
strarray_add
(
spec_args
,
files
->
base
[
i
]
+
2
);
break
;
}
}
spawn
(
opts
->
prefix
,
spec_args
,
0
);
strarray_free
(
spec_args
);
return
spec_o_name
;
}
static
void
build
(
struct
options
*
opts
)
{
strarray
*
lib_dirs
,
*
files
;
strarray
*
spec_args
,
*
link_args
,
*
implib_args
,
*
tool
;
strarray
*
link_args
,
*
implib_args
,
*
tool
;
char
*
output_file
,
*
output_path
;
const
char
*
spec_o_name
,
*
libgcc
=
NULL
;
const
char
*
output_name
,
*
spec_file
,
*
lang
;
...
...
@@ -1287,85 +1382,8 @@ static void build(struct options* opts)
else
entry_point
=
opts
->
entry_point
;
/* run winebuild to generate the .spec.o file */
spec_args
=
get_winebuild_args
(
opts
);
if
((
tool
=
build_tool_name
(
opts
,
TOOL_CC
)))
strarray_add
(
spec_args
,
strmake
(
"--cc-cmd=%s"
,
strarray_tostring
(
tool
,
" "
)));
if
(
!
is_pe
&&
(
tool
=
build_tool_name
(
opts
,
TOOL_LD
)))
strarray_add
(
spec_args
,
strmake
(
"--ld-cmd=%s"
,
strarray_tostring
(
tool
,
" "
)));
spec_o_name
=
get_temp_file
(
output_name
,
".spec.o"
);
if
(
opts
->
force_pointer_size
)
strarray_add
(
spec_args
,
strmake
(
"-m%u"
,
8
*
opts
->
force_pointer_size
));
strarray_add
(
spec_args
,
"-D_REENTRANT"
);
if
(
opts
->
pic
&&
!
is_pe
)
strarray_add
(
spec_args
,
"-fPIC"
);
strarray_add
(
spec_args
,
opts
->
shared
?
"--dll"
:
"--exe"
);
if
(
fake_module
)
{
strarray_add
(
spec_args
,
"--fake-module"
);
strarray_add
(
spec_args
,
"-o"
);
strarray_add
(
spec_args
,
output_file
);
}
else
{
strarray_add
(
spec_args
,
"-o"
);
strarray_add
(
spec_args
,
spec_o_name
);
}
if
(
spec_file
)
{
strarray_add
(
spec_args
,
"-E"
);
strarray_add
(
spec_args
,
spec_file
);
}
if
(
!
opts
->
shared
)
{
strarray_add
(
spec_args
,
"-F"
);
strarray_add
(
spec_args
,
output_name
);
strarray_add
(
spec_args
,
"--subsystem"
);
strarray_add
(
spec_args
,
opts
->
gui_app
?
"windows"
:
"console"
);
if
(
opts
->
large_address_aware
)
strarray_add
(
spec_args
,
"--large-address-aware"
);
}
if
(
opts
->
target_platform
==
PLATFORM_WINDOWS
)
strarray_add
(
spec_args
,
"--safeseh"
);
spec_o_name
=
build_spec_obj
(
opts
,
spec_file
,
output_file
,
files
,
lib_dirs
,
entry_point
);
if
(
entry_point
)
{
strarray_add
(
spec_args
,
"--entry"
);
strarray_add
(
spec_args
,
entry_point
);
}
if
(
opts
->
subsystem
)
{
strarray_add
(
spec_args
,
"--subsystem"
);
strarray_add
(
spec_args
,
opts
->
subsystem
);
}
for
(
j
=
0
;
j
<
lib_dirs
->
size
;
j
++
)
strarray_add
(
spec_args
,
strmake
(
"-L%s"
,
lib_dirs
->
base
[
j
]));
if
(
!
is_pe
)
{
for
(
j
=
0
;
j
<
opts
->
delayimports
->
size
;
j
++
)
strarray_add
(
spec_args
,
strmake
(
"-d%s"
,
opts
->
delayimports
->
base
[
j
]));
}
/* add resource files */
for
(
j
=
0
;
j
<
files
->
size
;
j
++
)
if
(
files
->
base
[
j
][
1
]
==
'r'
)
strarray_add
(
spec_args
,
files
->
base
[
j
]);
/* add other files */
strarray_add
(
spec_args
,
"--"
);
for
(
j
=
0
;
j
<
files
->
size
;
j
++
)
{
switch
(
files
->
base
[
j
][
1
])
{
case
'd'
:
case
'a'
:
case
'o'
:
strarray_add
(
spec_args
,
files
->
base
[
j
]
+
2
);
break
;
}
}
spawn
(
opts
->
prefix
,
spec_args
,
0
);
strarray_free
(
spec_args
);
if
(
fake_module
)
return
;
/* nothing else to do */
/* link everything together now */
...
...
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