1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/build/cygwin-wrapper Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +#!/bin/sh 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +# 1.10 +# Stupid wrapper to avoid win32 dospath/cygdrive issues 1.11 +# Try not to spawn programs from within this file. If the stuff in here looks royally 1.12 +# confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643 1.13 +# and look at the older versions of this file that are easier to read, but 1.14 +# do basically the same thing 1.15 +# 1.16 + 1.17 +prog=$1 1.18 +shift 1.19 +if test -z "$prog"; then 1.20 + exit 0 1.21 +fi 1.22 + 1.23 +# If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p 1.24 +mountpoint=$CYGDRIVE_MOUNT 1.25 +if test -z "$mountpoint"; then 1.26 + mountpoint=`mount -p` 1.27 + if test -z "$mountpoint"; then 1.28 + print "Cannot determine cygwin mount points. Exiting" 1.29 + exit 1 1.30 + fi 1.31 +fi 1.32 + 1.33 +# Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p` 1.34 +mountpoint=${mountpoint#*/} 1.35 +mountpoint=/${mountpoint%%[!A-Za-z0-9_]*} 1.36 +mountpoint=${mountpoint%/} 1.37 + 1.38 +args="" 1.39 +up="" 1.40 +if test "${prog}" = "-up"; then 1.41 + up=1 1.42 + prog=${1} 1.43 + shift 1.44 +fi 1.45 + 1.46 +process=1 1.47 + 1.48 +# Convert the mountpoint in parameters to Win32 filenames 1.49 +# For instance: /cygdrive/c/foo -> c:/foo 1.50 +for i in "${@}" 1.51 +do 1.52 + if test "${i}" = "-wrap"; then 1.53 + process=1 1.54 + else 1.55 + if test "${i}" = "-nowrap"; then 1.56 + process= 1.57 + else 1.58 + if test -n "${process}"; then 1.59 + if test -n "${up}"; then 1.60 + pathname=${i#-I[a-zA-Z]:/} 1.61 + if ! test "${pathname}" = "${i}"; then 1.62 + no_i=${i#-I} 1.63 + driveletter=${no_i%%:*} 1.64 + i=-I${mountpoint}/${driveletter}/${pathname} 1.65 + fi 1.66 + else 1.67 + eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}' 1.68 + if ! test "${leader}" = "${i}"; then 1.69 + eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}' 1.70 + eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}' 1.71 + driveletter=${no_mountpoint%%/*} 1.72 + i=${leader}${driveletter}:/${pathname} 1.73 + fi 1.74 + fi 1.75 + fi 1.76 + 1.77 + args="${args} ${i}" 1.78 + fi 1.79 + fi 1.80 +done 1.81 + 1.82 +exec $prog $args