File: mk4build

package info (click to toggle)
brltty 5.6-10~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 25,116 kB
  • sloc: ansic: 117,871; sh: 6,590; java: 4,785; xml: 3,451; makefile: 1,973; tcl: 1,499; awk: 611; ml: 293; python: 250; lisp: 52
file content (143 lines) | stat: -rwxr-xr-x 3,841 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/sh
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
#          text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2018 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU Lesser General Public License, as published by the Free Software
# Foundation; either version 2.1 of the License, or (at your option) any
# later version. Please see the file LICENSE-LGPL for details.
#
# Web Page: http://brltty.com/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

. "`dirname "${0}"`/prologue.sh"
set -e

inputName="config"
outputName="forbuild"

headerExtension="h"
logExtension="log"
makeExtension="mk"
sedExtension="sed"
statusExtension="status"

makeInput="${inputName}.${makeExtension}"
makeOutput="${initialDirectory}/${outputName}.${makeExtension}"

sourceRoot=""

while getopts ":s:" option
do
   case "${option}"
   in
      s) sourceRoot="${OPTARG}";;
      :) syntaxError "missing value: -${OPTARG}";;
     \?) syntaxError "unknown option: -${OPTARG}";;
      *) syntaxError "unimplemented option: -${option}";;
   esac
done
shift `expr "${OPTIND}" - 1`

[ "${#}" -eq 0 ] || syntaxError "too many parameters."

[ -n "${sourceRoot}" ] || sourceRoot=`dirname "${0}"`
[ -d "${sourceRoot}" ] || semanticError "source root not found: ${sourceRoot}"
sourceRoot=`cd "${sourceRoot}" && pwd` || exit "${?}"

getMakeProperty() {
   grep "^ *${1} *=" "${makeInput}" | sed -e 's/^[^=]*= *//' -e 's/ *$//'
}

buildSystem=`getMakeProperty BUILD_SYSTEM`
hostSystem=`getMakeProperty HOST_SYSTEM`

objectExtension='$(O_FOR_BUILD)'

if [ "${hostSystem}" != "${buildSystem}" ]
then
   objectExtension="build.${objectExtension}"

   needTemporaryDirectory

   for variable in CC CFLAGS CXX CXXFLAGS LDFLAGS LDLIBS
   do
      unset "${variable}"
      variableForBuild="${variable}_FOR_BUILD"
      eval test '"${'"${variableForBuild}"'+set}"' != "set" || eval "${variable}"'="${'"${variableForBuild}"'}"'
   done

   "${sourceRoot}/configure" \
      --disable-api \
      --disable-gpm \
      --disable-iconv \
      --disable-icu \
      --disable-x \
      \
      --without-libbraille \
      --with-braille-driver=-all \
      \
      --disable-speech-support \
      --with-speech-driver=-all \
      \
      -with-screen-driver=-all \
      \
      --without-pgmpath-package \
      --without-service-package \
      --without-params-package \
      --without-dynld-package \
      --without-charset-package \
      --without-hostcmd-package \
      --without-mntpt-package \
      --without-mntfs-package \
      --without-kbd-package \
      --without-beep-package \
      --without-pcm-package \
      --without-midi-package \
      --without-fm-package \
      --without-serial-package \
      --without-usb-package \
      --without-bluetooth-package \
      --without-ports-package \
      \
      --quiet
fi

sedScript="${outputName}.${sedExtension}"
sed -n -e '
s/^ *\([A-Za-z][A-Za-z_]*\) *=.*$/\1/
t found
d
:found
h
s/^\(.*\)$/s%^\\( *\\)\\(\1\\)\\( *=\\)%\\1\\2_FOR_BUILD\\3%/p
g
s/^\(.*\)$/s%\\(\\$(\\)\\(\1\\)\\([):]\\)%\\1\\2_FOR_BUILD\\3%g/p
g
s/^\(.\)$/s%\\$\\(\1\\)%$(\\1_FOR_BUILD)%g/p
' <"${makeInput}" >"${sedScript}"

echo "\$a\\
B = ${objectExtension}
" >>"${sedScript}"

sed <"${makeInput}" >"${makeOutput}" -f "${sedScript}"
rm "${sedScript}"

for extension in "${headerExtension}" "${logExtension}" "${statusExtension}"
do
   inputFile="${inputName}.${extension}"

   [ ! -f "${inputFile}" ] || {
      cp "${inputFile}" "${initialDirectory}/${outputName}.${extension}"
   }
done

exit 0