Bug 138832

Summary: [GTK] LDFLAGS is ignored when running g-ir-scanner
Product: WebKit Reporter: Ting-Wei Lan <lantw44>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, cgarcia, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Other   
Bug Depends on:    
Bug Blocks: 138833    
Attachments:
Description Flags
[GTK] LDFLAGS is ignored when running g-ir-scanner
none
[GTK] LDFLAGS is ignored when running g-ir-scanner
none
[GTK] LDFLAGS is ignored when running g-ir-scanner none

Description Ting-Wei Lan 2014-11-18 05:37:16 PST
GTK+ requires libintl on FreeBSD because there is no gettext
implementation in FreeBSD libc. In order to link to libintl, which is
not located in the default search path of the linker, we need to add
the required path via the linker command line. However, LDFLAGS is
ignored when running g-ir-scanner starting from r167873, so we have
to manually pick required flags from CMAKE_SHARED_LINKER_FLAGS and
put them in correct order to prevent g-ir-scanner from linking to
the installed version of libraries.
Comment 1 Ting-Wei Lan 2014-11-18 05:38:19 PST
Created attachment 241784 [details]
[GTK] LDFLAGS is ignored when running g-ir-scanner
Comment 2 Ting-Wei Lan 2014-11-23 05:48:46 PST
This patch is required to build WebKitGTK+ 2.6.x and 2.7.x on FreeBSD.
Comment 3 Ting-Wei Lan 2014-11-25 23:35:58 PST
Created attachment 242219 [details]
[GTK] LDFLAGS is ignored when running g-ir-scanner
Comment 4 Alberto Garcia 2014-12-08 02:05:55 PST
Comment on attachment 242219 [details]
[GTK] LDFLAGS is ignored when running g-ir-scanner

View in context: https://bugs.webkit.org/attachment.cgi?id=242219&action=review

> Source/WebKit2/PlatformGTK.cmake:757
> +# Add required -L flags from ${CMAKE_SHARED_LINKER_FLAGS} for g-ir-scanner
> +separate_arguments(INTROSPECTION_ADDITIONAL_LINKER_FLAGS
> +    UNIX_COMMAND ${CMAKE_SHARED_LINKER_FLAGS})
> +foreach (linker_flag ${INTROSPECTION_ADDITIONAL_LINKER_FLAGS})
> +    string(REGEX MATCH "-L[^ ]*" linker_flag_matched "${linker_flag}")
> +    string(COMPARE EQUAL "${linker_flag_matched}" "" linker_flag_not_allowed)
> +    if (linker_flag_not_allowed)
> +        list(REMOVE_ITEM INTROSPECTION_ADDITIONAL_LINKER_FLAGS "${linker_flag}")
> +    endif ()
> +endforeach (linker_flag)
> +

Isn't it easier to do this instead?

string(REGEX MATCHALL "-L[^ ]*" INTROSPECTION_ADDITIONAL_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
Comment 5 Ting-Wei Lan 2014-12-09 00:43:43 PST
Created attachment 242891 [details]
[GTK] LDFLAGS is ignored when running g-ir-scanner
Comment 6 Alberto Garcia 2014-12-09 01:24:48 PST
(In reply to comment #5)
> Created attachment 242891 [details]
> [GTK] LDFLAGS is ignored when running g-ir-scanner

I think that looks much better, thanks!
Comment 7 WebKit Commit Bot 2014-12-09 02:19:53 PST
Comment on attachment 242891 [details]
[GTK] LDFLAGS is ignored when running g-ir-scanner

Clearing flags on attachment: 242891

Committed r177016: <http://trac.webkit.org/changeset/177016>
Comment 8 WebKit Commit Bot 2014-12-09 02:19:57 PST
All reviewed patches have been landed.  Closing bug.