Liam McLoughlin | 4f268f4 | 2013-03-04 18:09:53 -0500 | [diff] [blame] | 1 | #!/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 | |
| 7 | set -e |
| 8 | |
| 9 | OUT=$1 |
| 10 | shift |
| 11 | for v; do |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 12 | # Extract all the libbrillo sublibs from 'dependencies' section of |
| 13 | # 'libbrillo-<(libbase_ver)' target in libbrillo.gypi and convert them |
| 14 | # into an array of "-lbrillo-<sublib>-<v>" flags. |
Alex Vakulenko | 02a06c4 | 2014-08-26 09:56:46 -0700 | [diff] [blame] | 15 | sublibs=($(sed -n " |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 16 | /'target_name': 'libbrillo-<(libbase_ver)'/,/target_name/ { |
Alex Vakulenko | 02a06c4 | 2014-08-26 09:56:46 -0700 | [diff] [blame] | 17 | /dependencies/,/],/ { |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 18 | /libbrillo/ { |
Alex Vakulenko | 02a06c4 | 2014-08-26 09:56:46 -0700 | [diff] [blame] | 19 | s:[',]::g |
| 20 | s:<(libbase_ver):${v}:g |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 21 | s:libbrillo:-lbrillo: |
Alex Vakulenko | 02a06c4 | 2014-08-26 09:56:46 -0700 | [diff] [blame] | 22 | p |
| 23 | } |
| 24 | } |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 25 | }" libbrillo.gypi)) |
Alex Vakulenko | 02a06c4 | 2014-08-26 09:56:46 -0700 | [diff] [blame] | 26 | |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 27 | echo "GROUP ( AS_NEEDED ( ${sublibs[@]} ) )" > "${OUT}"/lib/libbrillo-${v}.so |
Liam McLoughlin | 4f268f4 | 2013-03-04 18:09:53 -0500 | [diff] [blame] | 28 | |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 29 | deps=$(<"${OUT}"/gen/libbrillo-${v}-deps.txt) |
| 30 | pc="${OUT}"/lib/libbrillo-${v}.pc |
Liam McLoughlin | 4f268f4 | 2013-03-04 18:09:53 -0500 | [diff] [blame] | 31 | |
| 32 | sed \ |
| 33 | -e "s/@BSLOT@/${v}/g" \ |
| 34 | -e "s/@PRIVATE_PC@/${deps}/g" \ |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 35 | "libbrillo.pc.in" > "${pc}" |
Alex Vakulenko | f788c95 | 2014-08-20 17:35:12 -0700 | [diff] [blame] | 36 | |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 37 | deps_test=$(<"${OUT}"/gen/libbrillo-test-${v}-deps.txt) |
| 38 | deps_test+=" libbrillo-${v}" |
Alex Vakulenko | f788c95 | 2014-08-20 17:35:12 -0700 | [diff] [blame] | 39 | sed \ |
| 40 | -e "s/@BSLOT@/${v}/g" \ |
Alex Vakulenko | 678d980 | 2014-09-12 14:01:45 -0700 | [diff] [blame] | 41 | -e "s/@PRIVATE_PC@/${deps_test}/g" \ |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 42 | "libbrillo-test.pc.in" > "${OUT}/lib/libbrillo-test-${v}.pc" |
Christopher Wiley | 8065d31 | 2015-07-08 13:11:21 -0700 | [diff] [blame] | 43 | |
| 44 | |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 45 | deps_glib=$(<"${OUT}"/gen/libbrillo-glib-${v}-deps.txt) |
| 46 | pc_glib="${OUT}"/lib/libbrillo-glib-${v}.pc |
Christopher Wiley | 8065d31 | 2015-07-08 13:11:21 -0700 | [diff] [blame] | 47 | |
| 48 | sed \ |
| 49 | -e "s/@BSLOT@/${v}/g" \ |
| 50 | -e "s/@PRIVATE_PC@/${deps_glib}/g" \ |
Alex Vakulenko | fed60b0 | 2015-10-27 09:53:05 -0700 | [diff] [blame] | 51 | "libbrillo-glib.pc.in" > "${pc_glib}" |
Liam McLoughlin | 4f268f4 | 2013-03-04 18:09:53 -0500 | [diff] [blame] | 52 | done |