summaryrefslogtreecommitdiffstats
path: root/fixup_ptxconfigs.sh
blob: 897ea018801794bfc3ce98de5a11fbbcdf418915 (plain)
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
#!/bin/bash

fixup() {
    
    PARMS=`echo ${1} | sed -e "s/ptxconfigs\/\(.*\)_gcc-\(.*\)_glibc-\(.*\)_linux-\([^_-]*\).*\.ptxconfig/TARGET=\1 GCC=\2 GLIBC=\3 LINUX=\4/"`
    if test ! -e "${PARMS}"; then
	    eval ${PARMS}

       sed -i \
   	   -e "s/\(PTXCONF_GNU_TARGET\)=.*/\1=\"${TARGET}\"/" \
       -e "s/\(PTXCONF_CROSS_GCC_VERSION\)=.*/\1=\"${GCC}\"/" \
       -e "s/\(PTXCONF_GLIBC_VERSION\)=.*/\1=\"${GLIBC}\"/" \
       -e "s/\(PTXCONF_KERNEL_HEADERS_VERSION\)=.*/\1=\"${LINUX}\"/" \
       -e "s:\(PTXCONF_PREFIX\)=.*:\1=\"/opt\":" \
       ${1}
    fi
}

#
# main()
#
if test -n "${1}"; then
    fixup ${1}
else
    for config in `find ptxconfigs -name "*.ptxconfig"`; do
	fixup ${config}
    done
fi