comparison configure.rc @ 632:ed19b429a152

- added explicit arm64 target, and clang tool options to Windows' configure.bat - configure.{bat,rc} now writing Makefile.config, for consistency/compatibility (e.g. configure.bat can now be used to set up env flags for a non-nmake toolchain) - simplified/decluttered Windows and Plan9 configure scripts (removal of unused/stale options, ...) - removed stale test/makepkg.sh helper
author Tassilo Philipp
date Sat, 19 Nov 2022 15:45:41 +0100
parents 3e629dc19168
children a1732b269476
comparison
equal deleted inserted replaced
631:e5ad8cf0aa72 632:ed19b429a152
1 #!/bin/rc 1 #!/bin/rc
2 #////////////////////////////////////////////////////////////////////////////// 2 #//////////////////////////////////////////////////////////////////////////////
3 # 3 #
4 # Copyright (c) 2007-2010 Daniel Adler <dadler@uni-goettingen.de>, 4 # Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
5 # Tassilo Philipp <tphilipp@potion-studios.com> 5 # Tassilo Philipp <tphilipp@potion-studios.com>
6 # 6 #
7 # Permission to use, copy, modify, and distribute this software for any 7 # Permission to use, copy, modify, and distribute this software for any
8 # purpose with or without fee is hereby granted, provided that the above 8 # purpose with or without fee is hereby granted, provided that the above
9 # copyright notice and this permission notice appear in all copies. 9 # copyright notice and this permission notice appear in all copies.
19 #////////////////////////////////////////////////////////////////////////////// 19 #//////////////////////////////////////////////////////////////////////////////
20 20
21 # --- configure settings ------------------------------------------------------ 21 # --- configure settings ------------------------------------------------------
22 22
23 PACKAGE=dyncall 23 PACKAGE=dyncall
24 CONFIG_PREFIX=/usr/local #@@@
25 24
26 # --- output error message ---------------------------------------------------- 25
26 # --- message helpers ----------------------------------------------------
27 fn error { 27 fn error {
28 echo error: $* 28 echo error: $*
29 exit 1 29 exit 1
30 } 30 }
31
32 # --- output warning message --------------------------------------------------
33
34 fn warning { 31 fn warning {
35 echo warning: $* 32 echo warning: $*
36 } 33 }
37
38 # --- output info message -----------------------------------------------------
39
40 fn info { 34 fn info {
41 echo $* 35 echo $*
42 } 36 }
37
43 38
44 # --- print usage ------------------------------------------------------------- 39 # --- print usage -------------------------------------------------------------
45 40
46 fn usage { 41 fn usage {
47 echo $PACKAGE' configuration shell-script' 42 echo $PACKAGE' configuration shell-script'
59 #echo ' --target-arm-thumb build for ARM architecture platform (THUMB mode)' 54 #echo ' --target-arm-thumb build for ARM architecture platform (THUMB mode)'
60 #echo 55 #echo
61 #echo ' --tool-pcc use Portable C Compiler' 56 #echo ' --tool-pcc use Portable C Compiler'
62 #echo 57 #echo
63 #echo ' --asm-xa use Plan9 Assemblers (0a, 1a, 2a, etc.)' 58 #echo ' --asm-xa use Plan9 Assemblers (0a, 1a, 2a, etc.)'
64 #echo
65 #echo ' --config-release build release version (default)'
66 #echo ' --config-debug build debug version'
67 echo 59 echo
68 exit 0 60 exit 0
69 } 61 }
70 62
71 # --- guess operating system ------------------------------------------------- 63
64 # --- guess os, arch, ... -------------------------------------------------
72 65
73 CONFIG_OS=() 66 CONFIG_OS=()
74 fn guess_os { 67 fn guess_os {
75 CONFIG_OS='plan9' 68 CONFIG_OS='plan9'
76 info 'guess os '$CONFIG_OS 69 info 'guess os '$CONFIG_OS
77 } 70 }
78
79 # --- guess architecture -----------------------------------------------------
80 71
81 CONFIG_ARCH=() 72 CONFIG_ARCH=()
82 fn guess_arch { 73 fn guess_arch {
83 CONFIG_ARCH='x86' 74 CONFIG_ARCH='x86'
84 switch($cputype) { 75 switch($cputype) {
96 warning 'unknown architecture '$cputype' - using default (x86)' 87 warning 'unknown architecture '$cputype' - using default (x86)'
97 } 88 }
98 info 'guess arch '$CONFIG_ARCH 89 info 'guess arch '$CONFIG_ARCH
99 } 90 }
100 91
101 # --- guess tool chain -------------------------------------------------------
102
103 CONFIG_TOOL=() 92 CONFIG_TOOL=()
104 fn guess_tool { 93 fn guess_tool {
105 #CONFIG_TOOL=`{grep CC /$objtype/mkfile | sed s/CC.//} 94 #CONFIG_TOOL=`{grep CC /$objtype/mkfile | sed s/CC.//}
106 CONFIG_TOOL='pcc' 95 CONFIG_TOOL='pcc'
107 info 'guess tool '$CONFIG_TOOL 96 info 'guess tool '$CONFIG_TOOL
108 } 97 }
109 98
110 # --- guess assembler --------------------------------------------------------
111
112 CONFIG_ASM=() 99 CONFIG_ASM=()
113 fn guess_asm { 100 fn guess_asm {
114 CONFIG_ASM=`{grep AS /$objtype/mkfile | sed s/AS.//} 101 CONFIG_ASM=`{grep AS /$objtype/mkfile | sed s/AS.//}
115 info 'guess assembler '$CONFIG_ASM 102 info 'guess assembler '$CONFIG_ASM
116 } 103 }
117
118 # --- process arguments ------------------------------------------------------
119
120 fn args {
121 while(! ~ $#* 0 && ~ $1 -*) {
122 OPT=$1
123 shift
124
125 switch($OPT) {
126 case --help -h
127 usage
128 #case --target-x86
129 #CONFIG_ARCH='x86'
130 #case --target-x64
131 #CONFIG_ARCH='x64'
132 #case --target-ppc32
133 #CONFIG_ARCH='ppc32'
134 #case --target-arm-arm
135 #CONFIG_ARCH='arm32_arm'
136 #case --target-arm-thumb
137 #CONFIG_ARCH='arm32_thumb'
138 #case --tool-pcc
139 #CONFIG_TOOL=pcc
140 #CONFIG_ASM=2a
141 #case --tool-xa
142 #CONFIG_ASM=2a
143 #case --config-release
144 #CONFIG_CONFIG=release
145 #case --config-debug
146 #CONFIG_CONFIG=debug
147 case *
148 warning 'unknown option '$OPT
149 }
150 }
151 }
152
153 # --- guess variables --------------------------------------------------------
154 104
155 fn guess { 105 fn guess {
156 if(~ $#CONFIG_OS 0) { 106 if(~ $#CONFIG_OS 0) {
157 guess_os 107 guess_os
158 if(~ $#CONFIG_OS 0) { 108 if(~ $#CONFIG_OS 0) {
178 guess_asm 128 guess_asm
179 if(~ $#CONFIG_ASM 0) { 129 if(~ $#CONFIG_ASM 0) {
180 error 'no assembler tool' 130 error 'no assembler tool'
181 } 131 }
182 } 132 }
183
184 if(~ $#CONFIG_CONFIG 0) {
185 CONFIG_CONFIG=release
186 }
187 }
188
189 # --- set default variables --------------------------------------------------
190
191 fn set_defaults {
192 CONFIG_HOST=$CONFIG_OS
193 } 133 }
194 134
195 # --- derive variables -------------------------------------------------------
196 135
197 fn derive_vars { 136 # --- process arguments ------------------------------------------------------
198 BUILD_HOST=$CONFIG_HOST 137
199 if(! ~ $CONFIG_HOST $CONFIG_OS) { 138 fn args {
200 BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS 139 while(! ~ $#* 0 && ~ $1 -*) {
140 OPT=$1
141 shift
142
143 switch($OPT) {
144 case --help -h
145 usage
146 #case --target-x86
147 #CONFIG_ARCH='x86'
148 #case --target-x64
149 #CONFIG_ARCH='x64'
150 #case --target-ppc32
151 #CONFIG_ARCH='ppc32'
152 #case --target-arm-arm
153 #CONFIG_ARCH='arm32_arm'
154 #case --target-arm-thumb
155 #CONFIG_ARCH='arm32_thumb'
156 #case --tool-pcc
157 #CONFIG_TOOL=pcc
158 #CONFIG_ASM=2a
159 #case --tool-xa
160 #CONFIG_ASM=2a
161 case *
162 warning 'unknown option '$OPT
163 }
201 } 164 }
202 } 165 }
203 166
204 # --- write ConfigVars files ------------------------------------------------
205 167
206 fn output { 168
207 echo '#auto-generated by '$PACKAGE'/configure' >$1 169 args $*
208 echo 'CONFIG_PACKAGE='$PACKAGE >>$1 170 info '* configure package '$PACKAGE
209 echo 'CONFIG_HOST='$CONFIG_HOST >>$1 171 guess
210 echo 'CONFIG_OS='$CONFIG_OS >>$1 172
211 echo 'CONFIG_ARCH='$CONFIG_ARCH >>$1 173 CONFIG_HOST=$CONFIG_OS
212 echo 'CONFIG_TOOL='$CONFIG_TOOL >>$1 174 BUILD_HOST=$CONFIG_HOST
213 echo 'CONFIG_ASM='$CONFIG_ASM >>$1 175 if(! ~ $CONFIG_HOST $CONFIG_OS) {
214 echo 'CONFIG_CONFIG='$CONFIG_CONFIG >>$1 176 BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS
215 echo 'CONFIG_PREFIX='$CONFIG_PREFIX >>$1
216 if(! ~ $#CONFIG_BUILDPREFIX 0) {
217 echo 'CONFIG_BUILDPREFIX='$CONFIG_BUILDPREFIX >>$1
218 }
219 echo '' >>$1
220 } 177 }
221 178
222 # --- main ------------------------------------------------------------------- 179 echo '#auto-generated by '$PACKAGE'/configure' >$1
180 echo 'CONFIG_PACKAGE='$PACKAGE >>$1
181 echo 'CONFIG_HOST='$CONFIG_HOST >>$1
182 echo 'CONFIG_OS='$CONFIG_OS >>$1
183 echo 'CONFIG_ARCH='$CONFIG_ARCH >>$1
184 echo 'CONFIG_TOOL='$CONFIG_TOOL >>$1
185 echo 'CONFIG_ASM='$CONFIG_ASM >>$1
186 echo '' >>$1
223 187
224 fn main {
225 args $*
226 info '* configure package '$PACKAGE
227 guess
228 set_defaults
229 derive_vars
230 output ConfigVars
231 }
232
233 main $*
234