Debian Codegraph @

mk4build

raw
1 #!/bin/sh
2 ###############################################################################
3 # BRLTTY - A background process providing access to the console screen (when in
4 # text mode) for a blind person using a refreshable braille display.
5 #
6 # Copyright (C) 1995-2026 by The BRLTTY Developers.
7 #
8 # BRLTTY comes with ABSOLUTELY NO WARRANTY.
9 #
10 # This is free software, placed under the terms of the
11 # GNU Lesser General Public License, as published by the Free Software
12 # Foundation; either version 2.1 of the License, or (at your option) any
13 # later version. Please see the file LICENSE-LGPL for details.
14 #
15 # Web Page: http://brltty.app/
16 #
17 # This software is maintained by Dave Mielke <[email protected]>.
18 ###############################################################################
19
20 set -e
21
22 . "`dirname "${0}"`/brltty-prologue.sh"
23 defaultSourceRoot="${programDirectory}"
24 addProgramOption s string.directory sourceRoot "the top-level directory of the source tree" "${defaultSourceRoot}"
25 parseProgramArguments "${@}"
26
27 [ -n "${sourceRoot}" ] || sourceRoot="${defaultSourceRoot}"
28 [ -d "${sourceRoot}" ] || semanticError "source root not found: ${sourceRoot}"
29 sourceRoot=`cd "${sourceRoot}" && pwd` || exit "${?}"
30
31 inputName="config"
32 outputName="forbuild"
33
34 headerExtension="h"
35 logExtension="log"
36 makeExtension="mk"
37 sedExtension="sed"
38 statusExtension="status"
39
40 makeInput="${inputName}.${makeExtension}"
41 makeOutput="${initialDirectory}/${outputName}.${makeExtension}"
42
43 getMakeProperty() {
44 grep "^ *${1} *=" "${makeInput}" | sed -e 's/^[^=]*= *//' -e 's/ *$//'
45 }
46
47 buildSystem=`getMakeProperty BUILD_SYSTEM`
48 hostSystem=`getMakeProperty HOST_SYSTEM`
49
50 objectExtension='$(O_FOR_BUILD)'
51
52 if [ "${hostSystem}" != "${buildSystem}" ]
53 then
54 needTemporaryDirectory
55 objectExtension="build.${objectExtension}"
56
57 for variable in CC CFLAGS CXX CXXFLAGS LDFLAGS LDLIBS PKG_CONFIG PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
58 do
59 unset "${variable}"
60 getVariable "${variable}_FOR_BUILD" value
61
62 [ -n "${value}" ] && {
63 setVariable "${variable}" "${value}"
64 export "${variable}"
65 }
66 done
67
68 "${sourceRoot}/configure" \
69 --disable-api \
70 --disable-expat \
71 --disable-gpm \
72 --disable-iconv \
73 --disable-icu \
74 --disable-liblouis \
75 --disable-polkit \
76 --disable-x \
77 \
78 --without-libbraille \
79 --with-braille-driver=-all \
80 \
81 --disable-speech-support \
82 --with-speech-driver=-all \
83 \
84 -with-screen-driver=-all \
85 \
86 --without-pgmpath-package \
87 --without-pgmprivs-package \
88 --without-service-package \
89 --without-params-package \
90 --without-dynld-package \
91 --without-rgx-package \
92 --without-charset-package \
93 --without-hostcmd-package \
94 --without-mntpt-package \
95 --without-mntfs-package \
96 --without-kbd-package \
97 --without-beep-package \
98 --without-pcm-package \
99 --without-midi-package \
100 --without-fm-package \
101 --without-serial-package \
102 --without-usb-package \
103 --without-bluetooth-package \
104 --without-ports-package \
105 \
106 --quiet
107 fi
108
109 sedScript="${outputName}.${sedExtension}"
110 sed -n -e '
111 s/^ *\([A-Za-z][A-Za-z0-9_]*\) *=.*$/\1/
112 t found
113 d
114 :found
115 h
116 s/^\(.*\)$/s%^\\( *\\)\\(\1\\)\\( *=\\)%\\1\\2_FOR_BUILD\\3%/p
117 g
118 s/^\(.*\)$/s%\\(\\$(\\)\\(\1\\)\\([):]\\)%\\1\\2_FOR_BUILD\\3%g/p
119 g
120 s/^\(.\)$/s%\\$\\(\1\\)%$(\\1_FOR_BUILD)%g/p
121 ' <"${makeInput}" >"${sedScript}"
122
123 echo "\$a\\
124 B = ${objectExtension}
125 " >>"${sedScript}"
126
127 sed <"${makeInput}" >"${makeOutput}" -f "${sedScript}"
128 rm "${sedScript}"
129
130 for extension in "${headerExtension}" "${logExtension}" "${statusExtension}"
131 do
132 inputFile="${inputName}.${extension}"
133
134 [ ! -f "${inputFile}" ] || {
135 cp "${inputFile}" "${initialDirectory}/${outputName}.${extension}"
136 }
137 done
138
139 exit 0