blob: ecd015d056d9e273b31bc1e1f31228345e9b0641 [file] [log] [blame]
Liam McLoughlin4f268f42013-03-04 18:09:53 -05001#!/bin/bash
2
3# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7set -e
8
9OUT=$1
10shift
11for v; do
Alex Vakulenko02a06c42014-08-26 09:56:46 -070012 # Extract all the libchromeos sublibs from 'dependencies' section of
13 # 'libchromeos-<(libbase_ver)' target in libchromeos.gypi and convert them
14 # into an array of "-lchromeos-<sublib>-<v>" flags.
15 sublibs=($(sed -n "
16 /'target_name': 'libchromeos-<(libbase_ver)'/,/target_name/ {
17 /dependencies/,/],/ {
18 /libchromeos/ {
19 s:[',]::g
20 s:<(libbase_ver):${v}:g
21 s:libchromeos:-lchromeos:
22 p
23 }
24 }
25 }" libchromeos.gypi))
26
27 echo "GROUP ( AS_NEEDED ( ${sublibs[@]} ) )" > "${OUT}"/lib/libchromeos-${v}.so
Liam McLoughlin4f268f42013-03-04 18:09:53 -050028
29 deps=$(<"${OUT}"/gen/libchromeos-${v}-deps.txt)
30 pc="${OUT}"/lib/libchromeos-${v}.pc
31
32 sed \
33 -e "s/@BSLOT@/${v}/g" \
34 -e "s/@PRIVATE_PC@/${deps}/g" \
35 "libchromeos.pc.in" > "${pc}"
Alex Vakulenkof788c952014-08-20 17:35:12 -070036
37 deps_test=$(<"${OUT}"/gen/libchromeos-test-${v}-deps.txt)
Mike Frysinger81c0ad72015-05-28 08:57:25 -040038 deps_test+=" libchromeos-${v}"
Alex Vakulenkof788c952014-08-20 17:35:12 -070039 sed \
40 -e "s/@BSLOT@/${v}/g" \
Alex Vakulenko678d9802014-09-12 14:01:45 -070041 -e "s/@PRIVATE_PC@/${deps_test}/g" \
Alex Vakulenkof788c952014-08-20 17:35:12 -070042 "libchromeos-test.pc.in" > "${OUT}/lib/libchromeos-test-${v}.pc"
Christopher Wiley8065d312015-07-08 13:11:21 -070043
44
45 deps_glib=$(<"${OUT}"/gen/libchromeos-glib-${v}-deps.txt)
46 pc_glib="${OUT}"/lib/libchromeos-glib-${v}.pc
47
48 sed \
49 -e "s/@BSLOT@/${v}/g" \
50 -e "s/@PRIVATE_PC@/${deps_glib}/g" \
51 "libchromeos-glib.pc.in" > "${pc_glib}"
Liam McLoughlin4f268f42013-03-04 18:09:53 -050052done