Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
c697ee72
Commit
c697ee72
authored
3 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
winegcc: Add a helper function to build the .spec.o file.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3931375
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/winegcc/winegcc.c
+97
-79
97 additions, 79 deletions
tools/winegcc/winegcc.c
with
97 additions
and
79 deletions
tools/winegcc/winegcc.c
+
97
−
79
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 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment