source: rtems-source-builder/source-builder/sb/rtems-build-dep @ c799e04

Last change on this file since c799e04 was c799e04, checked in by Chris Johns <chrisj@…>, on Jul 6, 2019 at 9:20:09 AM

5/packages: Add curl and update all packages with RTEMS 5 and LibBSD

  • Update rtems-bsp support to correctly handle hosts for BSP.
  • Clean up the options for a BSP.
  • Check all RTEMS 5 packages and add 5/rtems-packages for all that build.
  • Update download locations and checksum of all packages.
  • The work requires the kernel and Libbsd hacve the same prefix.
  • Property mode set to 100755
File size: 3.8 KB
Line 
1#! /bin/sh
2#
3# RTEMS Tools Project (http://www.rtems.org/)
4# Copyright 2018 Chris Johns (chrisj@rtems.org)
5# All rights reserved.
6#
7# This file is part of the RTEMS Tools package in 'rtems-tools'.
8#
9# Permission to use, copy, modify, and/or distribute this software for any
10# purpose with or without fee is hereby granted, provided that the above
11# copyright notice and this permission notice appear in all copies.
12#
13# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20
21#
22# Host Build Dependence
23#
24# This script finds a file that is part of the compiler's default
25# build environment. The file can be header or a library.
26#
27# Header files:
28#  - Get the list of include directories from the compiler.
29#  - Search the include paths for the header file.
30#
31# Library:
32#  - Ask the compiler to print the library paths, add on any user
33#    paths and search with a wilecard.
34#
35
36set -e
37
38op=
39name=
40includes=
41libraries=
42compile=
43verbose=no
44debug=no
45
46if [ $# -eq 0 ]; then
47    echo 'Usage: rtems-build-dep [-c compiler] [-H header] [-I header-paths]
48                       [-l library] [-L library-paths] [-v] [-d]'
49    exit 2
50fi
51while [ $# -gt 0 ]
52do
53    case "$1"
54    in
55        -c)
56            if [ $# -eq 1 ]; then
57                echo 'error: no compiler (-c) provided'
58                exit 2
59            fi
60            compiler="$2"; shift;
61            shift;;
62        -H)
63            if [ $# -eq 1 ]; then
64                echo 'error: no header (-H) provided'
65                exit 2
66            fi
67            op="header"
68            name="$2"; shift;
69            shift;;
70        -I)
71            if [ $# -eq 1 ]; then
72                echo 'error: no header path (-I) provided'
73                exit 2
74            fi
75            includes="${includes} $2"; shift;
76            shift;;
77        -l)
78            if [ $# -eq 1 ]; then
79                echo 'error: no library (-l) provided'
80                exit 2
81            fi
82            op="library"
83            name="$2"; shift;
84            shift;;
85        -L)
86            if [ $# -eq 1 ]; then
87                echo 'error: no library path (-L) provided'
88                exit 2
89            fi
90            libraries="$2"; shift;
91            shift;;
92        -v)
93            verbose=yes
94            shift;;
95        -d)
96            debug=yes
97            shift;;
98        *)
99            break;
100    esac
101done
102
103if [ ${debug} = yes ]; then
104    set -x
105fi
106
107if [ -z "${op}" ]; then
108    echo "error: no header or library file to find found."
109    exit 2
110fi
111if [ -z "${compiler}" ]; then
112    echo "error: no compiler provided."
113    exit 2
114fi
115if [ -z "${name}" ]; then
116    echo "error: no name found."
117    exit 2
118fi
119
120#
121# Header file.
122#
123if [ ${op} = "header" ]; then
124    inc_paths=$(echo | LC_ALL=C ${compiler} ${includes} -xc -E -v - 2>&1 | tr -d '\r' | \
125               awk 'BEGIN {flag=0;} /starts here/{flag=1;next}/End/{flag=0}flag')
126    for p in ${inc_paths}
127    do
128        if [ ${verbose} = yes ]; then
129            echo "Include: ${p}"
130        fi
131        if [ -f "${p}/${name}" ]; then
132            echo "found"
133            exit 0
134        fi
135    done
136    echo "not-found"
137    exit 0
138fi
139
140#
141# Library file
142#
143if [ ${op} = "library" ]; then
144    if [ "${OS}" = "Windows_NT" -a "${OSTYPE}" != "cygwin" ]; then
145        sep=';'
146    else
147        sep=':'
148    fi
149    lib_paths_1=$(LC_ALL=C ${compiler} -print-search-dirs 2>&1 | tr -d '\r' | \
150                      grep libraries | \
151                      sed -e 's/libraries:.*=//' | \
152                      awk 'BEGIN {FS="'${sep}'"} {for (i=0;++i<=NF;) print $i;}')
153    lib_paths_2=$(echo ${libraries} | \
154                      awk 'BEGIN {FS="-L"} {for (i=0;++i<=NF;) if (length($i) > 0) print $i;}')
155    for p in ${lib_paths_1} ${lib_paths_2}
156    do
157        if [ ${verbose} = yes ]; then
158            echo "Library: ${p}/${name}"
159        fi
160        if ls ${p}/${name} 1> /dev/null 2>&1; then
161            echo "found"
162            exit 0
163        fi
164    done
165    echo "not-found"
166    exit 0
167fi
168
169exit 1
Note: See TracBrowser for help on using the repository browser.