1.1 --- a/common/autoconf/builddeps.m4 Wed Oct 09 18:51:32 2013 -0700 1.2 +++ b/common/autoconf/builddeps.m4 Thu Oct 10 14:58:19 2013 +0200 1.3 @@ -25,223 +25,223 @@ 1.4 1.5 AC_DEFUN_ONCE([BDEPS_SCAN_FOR_BUILDDEPS], 1.6 [ 1.7 - define(LIST_OF_BUILD_DEPENDENCIES,) 1.8 - if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then 1.9 - if test "x$with_builddeps_conf" != x; then 1.10 - AC_MSG_CHECKING([for supplied builddeps configuration file]) 1.11 - builddepsfile=$with_builddeps_conf 1.12 - if test -s $builddepsfile; then 1.13 - . $builddepsfile 1.14 - AC_MSG_RESULT([loaded!]) 1.15 - else 1.16 - AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!]) 1.17 - fi 1.18 - else 1.19 - AC_MSG_CHECKING([for builddeps.conf files in sources...]) 1.20 - builddepsfile=`mktemp` 1.21 - touch $builddepsfile 1.22 - # Put all found confs into a single file. 1.23 - find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile 1.24 - # Source the file to acquire the variables 1.25 - if test -s $builddepsfile; then 1.26 - . $builddepsfile 1.27 - AC_MSG_RESULT([found at least one!]) 1.28 - else 1.29 - AC_MSG_ERROR([Could not find any builddeps.conf at all!]) 1.30 - fi 1.31 - fi 1.32 - # Create build and target names that use _ instead of "-" and ".". 1.33 - # This is necessary to use them in variable names. 1.34 - build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'` 1.35 - target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'` 1.36 - # Extract rewrite information for build and target 1.37 - eval rewritten_build=\${REWRITE_${build_var}} 1.38 - if test "x$rewritten_build" = x; then 1.39 - rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME} 1.40 - echo Build stays the same $rewritten_build 1.41 - else 1.42 - echo Rewriting build for builddeps into $rewritten_build 1.43 - fi 1.44 - eval rewritten_target=\${REWRITE_${target_var}} 1.45 - if test "x$rewritten_target" = x; then 1.46 - rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME} 1.47 - echo Target stays the same $rewritten_target 1.48 - else 1.49 - echo Rewriting target for builddeps into $rewritten_target 1.50 - fi 1.51 - rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'` 1.52 - rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'` 1.53 + define(LIST_OF_BUILD_DEPENDENCIES,) 1.54 + if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then 1.55 + if test "x$with_builddeps_conf" != x; then 1.56 + AC_MSG_CHECKING([for supplied builddeps configuration file]) 1.57 + builddepsfile=$with_builddeps_conf 1.58 + if test -s $builddepsfile; then 1.59 + . $builddepsfile 1.60 + AC_MSG_RESULT([loaded!]) 1.61 + else 1.62 + AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!]) 1.63 + fi 1.64 + else 1.65 + AC_MSG_CHECKING([for builddeps.conf files in sources...]) 1.66 + builddepsfile=`mktemp` 1.67 + touch $builddepsfile 1.68 + # Put all found confs into a single file. 1.69 + find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile 1.70 + # Source the file to acquire the variables 1.71 + if test -s $builddepsfile; then 1.72 + . $builddepsfile 1.73 + AC_MSG_RESULT([found at least one!]) 1.74 + else 1.75 + AC_MSG_ERROR([Could not find any builddeps.conf at all!]) 1.76 + fi 1.77 fi 1.78 - AC_CHECK_PROGS(BDEPS_UNZIP, [7z unzip]) 1.79 - if test "x$BDEPS_UNZIP" = x7z; then 1.80 - BDEPS_UNZIP="7z x" 1.81 + # Create build and target names that use _ instead of "-" and ".". 1.82 + # This is necessary to use them in variable names. 1.83 + build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'` 1.84 + target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'` 1.85 + # Extract rewrite information for build and target 1.86 + eval rewritten_build=\${REWRITE_${build_var}} 1.87 + if test "x$rewritten_build" = x; then 1.88 + rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME} 1.89 + echo Build stays the same $rewritten_build 1.90 + else 1.91 + echo Rewriting build for builddeps into $rewritten_build 1.92 fi 1.93 + eval rewritten_target=\${REWRITE_${target_var}} 1.94 + if test "x$rewritten_target" = x; then 1.95 + rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME} 1.96 + echo Target stays the same $rewritten_target 1.97 + else 1.98 + echo Rewriting target for builddeps into $rewritten_target 1.99 + fi 1.100 + rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'` 1.101 + rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'` 1.102 + fi 1.103 + AC_CHECK_PROGS(BDEPS_UNZIP, [7z unzip]) 1.104 + if test "x$BDEPS_UNZIP" = x7z; then 1.105 + BDEPS_UNZIP="7z x" 1.106 + fi 1.107 1.108 - AC_CHECK_PROGS(BDEPS_FTP, [wget lftp ftp]) 1.109 + AC_CHECK_PROGS(BDEPS_FTP, [wget lftp ftp]) 1.110 ]) 1.111 1.112 AC_DEFUN([BDEPS_FTPGET], 1.113 [ 1.114 - # $1 is the ftp://abuilddeps.server.com/libs/cups.zip 1.115 - # $2 is the local file name for the downloaded file. 1.116 - VALID_TOOL=no 1.117 - if test "x$BDEPS_FTP" = xwget; then 1.118 - VALID_TOOL=yes 1.119 - wget -O $2 $1 1.120 + # $1 is the ftp://abuilddeps.server.com/libs/cups.zip 1.121 + # $2 is the local file name for the downloaded file. 1.122 + VALID_TOOL=no 1.123 + if test "x$BDEPS_FTP" = xwget; then 1.124 + VALID_TOOL=yes 1.125 + wget -O $2 $1 1.126 + fi 1.127 + if test "x$BDEPS_FTP" = xlftp; then 1.128 + VALID_TOOL=yes 1.129 + lftp -c "get $1 -o $2" 1.130 + fi 1.131 + if test "x$BDEPS_FTP" = xftp; then 1.132 + VALID_TOOL=yes 1.133 + FTPSERVER=`echo $1 | cut -f 3 -d '/'` 1.134 + FTPPATH=`echo $1 | cut -f 4- -d '/'` 1.135 + FTPUSERPWD=${FTPSERVER%%@*} 1.136 + if test "x$FTPSERVER" != "x$FTPUSERPWD"; then 1.137 + FTPUSER=${userpwd%%:*} 1.138 + FTPPWD=${userpwd#*@} 1.139 + FTPSERVER=${FTPSERVER#*@} 1.140 + else 1.141 + FTPUSER=ftp 1.142 + FTPPWD=ftp 1.143 fi 1.144 - if test "x$BDEPS_FTP" = xlftp; then 1.145 - VALID_TOOL=yes 1.146 - lftp -c "get $1 -o $2" 1.147 - fi 1.148 - if test "x$BDEPS_FTP" = xftp; then 1.149 - VALID_TOOL=yes 1.150 - FTPSERVER=`echo $1 | cut -f 3 -d '/'` 1.151 - FTPPATH=`echo $1 | cut -f 4- -d '/'` 1.152 - FTPUSERPWD=${FTPSERVER%%@*} 1.153 - if test "x$FTPSERVER" != "x$FTPUSERPWD"; then 1.154 - FTPUSER=${userpwd%%:*} 1.155 - FTPPWD=${userpwd#*@} 1.156 - FTPSERVER=${FTPSERVER#*@} 1.157 - else 1.158 - FTPUSER=ftp 1.159 - FTPPWD=ftp 1.160 - fi 1.161 - # the "pass" command does not work on some 1.162 - # ftp clients (read ftp.exe) but if it works, 1.163 - # passive mode is better! 1.164 - (\ 1.165 - echo "user $FTPUSER $FTPPWD" ;\ 1.166 - echo "pass" ;\ 1.167 - echo "bin" ;\ 1.168 - echo "get $FTPPATH $2" ;\ 1.169 - ) | ftp -in $FTPSERVER 1.170 - fi 1.171 - if test "x$VALID_TOOL" != xyes; then 1.172 - AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP]) 1.173 - fi 1.174 + # the "pass" command does not work on some 1.175 + # ftp clients (read ftp.exe) but if it works, 1.176 + # passive mode is better! 1.177 + ( \ 1.178 + echo "user $FTPUSER $FTPPWD" ; \ 1.179 + echo "pass" ; \ 1.180 + echo "bin" ; \ 1.181 + echo "get $FTPPATH $2" ; \ 1.182 + ) | ftp -in $FTPSERVER 1.183 + fi 1.184 + if test "x$VALID_TOOL" != xyes; then 1.185 + AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP]) 1.186 + fi 1.187 ]) 1.188 1.189 AC_DEFUN([BDEPS_CHECK_MODULE], 1.190 [ 1.191 - define([LIST_OF_BUILD_DEPENDENCIES],LIST_OF_BUILD_DEPENDENCIES[$2=$3'\n']) 1.192 - if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then 1.193 - # Source the builddeps file again, to make sure it uses the latest variables! 1.194 - . $builddepsfile 1.195 - # Look for a target and build machine specific resource! 1.196 - eval resource=\${builddep_$2_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}} 1.197 - if test "x$resource" = x; then 1.198 - # Ok, lets instead look for a target specific resource 1.199 - eval resource=\${builddep_$2_TARGET_${rewritten_target_var}} 1.200 - fi 1.201 - if test "x$resource" = x; then 1.202 - # Ok, lets instead look for a build specific resource 1.203 - eval resource=\${builddep_$2_BUILD_${rewritten_build_var}} 1.204 - fi 1.205 - if test "x$resource" = x; then 1.206 - # Ok, lets instead look for a generic resource 1.207 - # (The $2 comes from M4 and not the shell, thus no need for eval here.) 1.208 - resource=${builddep_$2} 1.209 - fi 1.210 - if test "x$resource" != x; then 1.211 - AC_MSG_NOTICE([Using builddeps $resource for $2]) 1.212 - # If the resource in the builddeps.conf file is an existing directory, 1.213 - # for example /java/linux/cups 1.214 - if test -d ${resource}; then 1.215 - depdir=${resource} 1.216 - else 1.217 - BDEPS_FETCH($2, $resource, $with_builddeps_server, $with_builddeps_dir, depdir) 1.218 - fi 1.219 - # Source the builddeps file again, because in the previous command, the depdir 1.220 - # was updated to point at the current build dependency install directory. 1.221 - . $builddepsfile 1.222 - # Now extract variables from the builddeps.conf files. 1.223 - theroot=${builddep_$2_ROOT} 1.224 - thecflags=${builddep_$2_CFLAGS} 1.225 - thelibs=${builddep_$2_LIBS} 1.226 - if test "x$depdir" = x; then 1.227 - AC_MSG_ERROR([Could not download build dependency $2]) 1.228 - fi 1.229 - $1=$depdir 1.230 - if test "x$theroot" != x; then 1.231 - $1="$theroot" 1.232 - fi 1.233 - if test "x$thecflags" != x; then 1.234 - $1_CFLAGS="$thecflags" 1.235 - fi 1.236 - if test "x$thelibs" != x; then 1.237 - $1_LIBS="$thelibs" 1.238 - fi 1.239 - m4_default([$4], [:]) 1.240 - m4_ifvaln([$5], [else $5]) 1.241 - fi 1.242 - m4_ifvaln([$5], [else $5]) 1.243 + define([LIST_OF_BUILD_DEPENDENCIES],LIST_OF_BUILD_DEPENDENCIES[$2=$3'\n']) 1.244 + if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then 1.245 + # Source the builddeps file again, to make sure it uses the latest variables! 1.246 + . $builddepsfile 1.247 + # Look for a target and build machine specific resource! 1.248 + eval resource=\${builddep_$2_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}} 1.249 + if test "x$resource" = x; then 1.250 + # Ok, lets instead look for a target specific resource 1.251 + eval resource=\${builddep_$2_TARGET_${rewritten_target_var}} 1.252 fi 1.253 + if test "x$resource" = x; then 1.254 + # Ok, lets instead look for a build specific resource 1.255 + eval resource=\${builddep_$2_BUILD_${rewritten_build_var}} 1.256 + fi 1.257 + if test "x$resource" = x; then 1.258 + # Ok, lets instead look for a generic resource 1.259 + # (The $2 comes from M4 and not the shell, thus no need for eval here.) 1.260 + resource=${builddep_$2} 1.261 + fi 1.262 + if test "x$resource" != x; then 1.263 + AC_MSG_NOTICE([Using builddeps $resource for $2]) 1.264 + # If the resource in the builddeps.conf file is an existing directory, 1.265 + # for example /java/linux/cups 1.266 + if test -d ${resource}; then 1.267 + depdir=${resource} 1.268 + else 1.269 + BDEPS_FETCH($2, $resource, $with_builddeps_server, $with_builddeps_dir, depdir) 1.270 + fi 1.271 + # Source the builddeps file again, because in the previous command, the depdir 1.272 + # was updated to point at the current build dependency install directory. 1.273 + . $builddepsfile 1.274 + # Now extract variables from the builddeps.conf files. 1.275 + theroot=${builddep_$2_ROOT} 1.276 + thecflags=${builddep_$2_CFLAGS} 1.277 + thelibs=${builddep_$2_LIBS} 1.278 + if test "x$depdir" = x; then 1.279 + AC_MSG_ERROR([Could not download build dependency $2]) 1.280 + fi 1.281 + $1=$depdir 1.282 + if test "x$theroot" != x; then 1.283 + $1="$theroot" 1.284 + fi 1.285 + if test "x$thecflags" != x; then 1.286 + $1_CFLAGS="$thecflags" 1.287 + fi 1.288 + if test "x$thelibs" != x; then 1.289 + $1_LIBS="$thelibs" 1.290 + fi 1.291 + m4_default([$4], [:]) 1.292 + m4_ifvaln([$5], [else $5]) 1.293 + fi 1.294 + m4_ifvaln([$5], [else $5]) 1.295 + fi 1.296 ]) 1.297 1.298 AC_DEFUN([BDEPS_FETCH], 1.299 [ 1.300 -# $1 is for example mymodule 1.301 -# $2 is for example libs/general/libmymod_1_2_3.zip 1.302 -# $3 is for example ftp://mybuilddeps.myserver.com/builddeps 1.303 -# $4 is for example /localhome/builddeps 1.304 -# $5 is the name of the variable into which we store the depdir, eg MYMOD 1.305 -# Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and 1.306 -# unzip into the directory: /localhome/builddeps/libmymod_1_2_3 1.307 - filename=`basename $2` 1.308 - filebase=`echo $filename | sed 's/\.[[^\.]]*$//'` 1.309 - filebase=${filename%%.*} 1.310 - extension=${filename#*.} 1.311 - installdir=$4/$filebase 1.312 - if test ! -f $installdir/$filename.unpacked; then 1.313 - AC_MSG_NOTICE([Downloading build dependency $1 from $3/$2 and installing into $installdir]) 1.314 - if test ! -d $installdir; then 1.315 - mkdir -p $installdir 1.316 - fi 1.317 - if test ! -d $installdir; then 1.318 - AC_MSG_ERROR([Could not create directory $installdir]) 1.319 - fi 1.320 - tmpfile=`mktemp $installdir/$1.XXXXXXXXX` 1.321 - touch $tmpfile 1.322 - if test ! -f $tmpfile; then 1.323 - AC_MSG_ERROR([Could not create files in directory $installdir]) 1.324 - fi 1.325 - BDEPS_FTPGET([$3/$2] , [$tmpfile]) 1.326 - mv $tmpfile $installdir/$filename 1.327 - if test ! -s $installdir/$filename; then 1.328 - AC_MSG_ERROR([Could not download $3/$2]) 1.329 - fi 1.330 - case "$extension" in 1.331 - zip) echo "Unzipping $installdir/$filename..." 1.332 - (cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked) 1.333 - ;; 1.334 - tar.gz) echo "Untaring $installdir/$filename..." 1.335 - (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) 1.336 - ;; 1.337 - tgz) echo "Untaring $installdir/$filename..." 1.338 - (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) 1.339 - ;; 1.340 - *) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension]) 1.341 - ;; 1.342 - esac 1.343 + # $1 is for example mymodule 1.344 + # $2 is for example libs/general/libmymod_1_2_3.zip 1.345 + # $3 is for example ftp://mybuilddeps.myserver.com/builddeps 1.346 + # $4 is for example /localhome/builddeps 1.347 + # $5 is the name of the variable into which we store the depdir, eg MYMOD 1.348 + # Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and 1.349 + # unzip into the directory: /localhome/builddeps/libmymod_1_2_3 1.350 + filename=`basename $2` 1.351 + filebase=`echo $filename | sed 's/\.[[^\.]]*$//'` 1.352 + filebase=${filename%%.*} 1.353 + extension=${filename#*.} 1.354 + installdir=$4/$filebase 1.355 + if test ! -f $installdir/$filename.unpacked; then 1.356 + AC_MSG_NOTICE([Downloading build dependency $1 from $3/$2 and installing into $installdir]) 1.357 + if test ! -d $installdir; then 1.358 + mkdir -p $installdir 1.359 fi 1.360 - if test -f $installdir/$filename.unpacked; then 1.361 - $5=$installdir 1.362 + if test ! -d $installdir; then 1.363 + AC_MSG_ERROR([Could not create directory $installdir]) 1.364 fi 1.365 + tmpfile=`mktemp $installdir/$1.XXXXXXXXX` 1.366 + touch $tmpfile 1.367 + if test ! -f $tmpfile; then 1.368 + AC_MSG_ERROR([Could not create files in directory $installdir]) 1.369 + fi 1.370 + BDEPS_FTPGET([$3/$2] , [$tmpfile]) 1.371 + mv $tmpfile $installdir/$filename 1.372 + if test ! -s $installdir/$filename; then 1.373 + AC_MSG_ERROR([Could not download $3/$2]) 1.374 + fi 1.375 + case "$extension" in 1.376 + zip) echo "Unzipping $installdir/$filename..." 1.377 + (cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked) 1.378 + ;; 1.379 + tar.gz) echo "Untaring $installdir/$filename..." 1.380 + (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) 1.381 + ;; 1.382 + tgz) echo "Untaring $installdir/$filename..." 1.383 + (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) 1.384 + ;; 1.385 + *) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension]) 1.386 + ;; 1.387 + esac 1.388 + fi 1.389 + if test -f $installdir/$filename.unpacked; then 1.390 + $5=$installdir 1.391 + fi 1.392 ]) 1.393 1.394 AC_DEFUN_ONCE([BDEPS_CONFIGURE_BUILDDEPS], 1.395 [ 1.396 -AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf], 1.397 - [use this configuration file for the builddeps])]) 1.398 + AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf], 1.399 + [use this configuration file for the builddeps])]) 1.400 1.401 -AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server], 1.402 - [download and use build dependencies from this server url])]) 1.403 + AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server], 1.404 + [download and use build dependencies from this server url])]) 1.405 1.406 -AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir], 1.407 - [store downloaded build dependencies here @<:@/localhome/builddeps@:>@])], 1.408 - [], 1.409 - [with_builddeps_dir=/localhome/builddeps]) 1.410 + AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir], 1.411 + [store downloaded build dependencies here @<:@/localhome/builddeps@:>@])], 1.412 + [], 1.413 + [with_builddeps_dir=/localhome/builddeps]) 1.414 1.415 -AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group], 1.416 - [chgrp the downloaded build dependencies to this group])]) 1.417 + AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group], 1.418 + [chgrp the downloaded build dependencies to this group])]) 1.419 ])