Skip to content

Commit

Permalink
meson: pkg-config search abi dir instead of used_apis
Browse files Browse the repository at this point in the history
Because apis in used_apis may produce multiple .lib.so files, use
var/abi/<arch> and search for .lib.so files when querying modules.

genodelabs#94
  • Loading branch information
ssumpf committed Jun 25, 2024
1 parent c859273 commit 17db994
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
13 changes: 7 additions & 6 deletions share/goa/lib/build/meson.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ proc create_cross_file { dir } {
puts $fh "strip = '${cross_dev_prefix}strip'"

#
# Custom pkg-config command that checks if required libraries are present in used_apis
# Custom pkg-config command that checks if required libraries are present in
# abi_dir
#
puts $fh "pkg-config = '$tool_dir/lib/pkg-config.tcl'"

Expand All @@ -58,7 +59,7 @@ proc create_cross_file { dir } {


proc create_or_update_build_dir { } {
global build_dir project_dir project_name
global build_dir project_dir abi_dir project_name
global cross_dev_prefix
global cppflags cflags cxxflags cc_cxx_opt_std
global ldflags ldlibs_common ldlibs_exe
Expand All @@ -72,10 +73,10 @@ proc create_or_update_build_dir { } {
set fh [open $pkg_config_log "WRONLY CREAT TRUNC"]
close $fh

# create link to used_apis to be processed by 'pkg-config.tcl'
set link_used_apis [file join $build_dir used_apis]
if {[expr ![file exists $link_used_apis]]} {
file link -symbolic $link_used_apis [file join $project_dir used_apis]
# create link to abi to be processed by 'pkg-config.tcl'
set link_abi [file join $build_dir abi]
if {[expr ![file exists $link_abi]]} {
file link -symbolic $link_abi $abi_dir
}

set source_dir [file join $project_dir src]
Expand Down
16 changes: 9 additions & 7 deletions share/goa/lib/pkg-config.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
#


proc using_api { api } {
global used_apis
foreach used_api $used_apis {
if {[archive_name $used_api] == $api} {
return 1 } }
proc using_abi { abis module } {

foreach abi $abis {
set rootname [file rootname [file rootname [file tail $abi]]]
if { $rootname == $module } { return 1 }
}
return 0
}

Expand Down Expand Up @@ -55,14 +56,15 @@ _consume_cmdline_switches "-*"

# PKG_CONFIG_LIBDIR is set in cross file via 'pkg_config_libdir' in [properties]
set build_dir $env(PKG_CONFIG_LIBDIR)
set used_apis [read_file_content_as_list [file join $build_dir used_apis]]
set abi_dir [file join $build_dir abi]
set abis [glob -directory $abi_dir -nocomplain -types { f d } *.lib.so]
set pkg_config_log [file join $build_dir "pkg-config.log"]
set modules $argv

set fh [open $pkg_config_log "WRONLY APPEND"]

foreach module $modules {
set found [using_api $module]
set found [using_abi $abis $module]
puts $fh "$module:$found"
}

Expand Down

0 comments on commit 17db994

Please sign in to comment.