"Fossies" - the Fresh Open Source Software Archive

Member "xdelta3-3.1.0/run_release.sh" (4 Jan 2016, 5780 Bytes) of package /linux/misc/xdelta3-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "run_release.sh": 3.0.11_vs_3.1.0.

    1 #!/bin/bash
    2 
    3 # Run from the source dir.
    4 SRCDIR=${PWD}
    5 
    6 # TODO replace w/ wget
    7 LZMA="xz-5.2.1"
    8 LZMA_FILE="${SRCDIR}/../${LZMA}.tar.xz"
    9 
   10 MAKEFLAGS="-j 10"
   11 
   12 BUILDDIR=${SRCDIR}/build
   13 LZMASRC=${BUILDDIR}/${LZMA}
   14 
   15 NONWIN_CFLAGS=""
   16 MINGW_CFLAGS="-DEXTERNAL_COMPRESSION=0 -DXD3_WIN32=1 -DSHELL_TESTS=0"
   17 
   18 MYOS=`uname`
   19 DATE=`date`
   20 
   21 CLEAN=""
   22 
   23 LINUXTGTS=""
   24 LINUXTEST1=""
   25 LINUXTEST2=""
   26 
   27 WINTGTS=""
   28 WINTEST1=""
   29 WINTEST2=""
   30 
   31 OSXTGTS=""
   32 OSXTEST1=""
   33 OSXTEST2=""
   34 
   35 XTMP="/tmp"
   36 if [ "${TMP}" != "" ]; then
   37     XTMP="${TMP}"
   38 fi
   39 if [ "${TMPDIR}" != "" ]; then
   40     XTMP="${TMPDIR}"
   41 fi
   42 
   43 find build -type f 2> /dev/null | xargs rm -f
   44 
   45 function setup {
   46     libtoolize
   47     automake --add-missing
   48     aclocal -I m4
   49     autoheader
   50     automake
   51     autoheader
   52     autoconf
   53 }
   54 
   55 function try {
   56     local w=$1
   57     shift
   58     local dir=$1
   59     shift
   60     echo -n "   ${w} ... "
   61     (cd "${dir}" && "$@" >${w}.stdout 2>${w}.stderr)
   62     local s=$?
   63     if [ ${s} -eq 0 ]; then
   64     echo " success"
   65     else
   66     echo " failed!"
   67     echo "Error $1 in ${dir}" >&2
   68     fi
   69     return ${s}
   70 }
   71 
   72 function buildlzma {
   73     host=$1
   74     march=$2
   75     local target="${BUILDDIR}/lib-${host}${march}"
   76 
   77     echo "  ... liblzma"
   78     
   79     mkdir -p ${target}
   80 
   81     try configure-lzma ${target} ${LZMASRC}/configure \
   82     --host=${host} \
   83     --prefix=${target} \
   84     --disable-shared \
   85     "CC=${CC}" \
   86     "CXX=${CXX}" \
   87     "CFLAGS=${march}" \
   88     "CXXFLAGS=${march}" \
   89     "LDFLAGS=${march}"
   90     if [ $? -ne 0 ]; then
   91     return
   92     fi
   93 
   94     try build-lzma ${target} make ${MAKEFLAGS}
   95     if [ $? -ne 0 ]; then
   96         return
   97     fi
   98     try install-lzma ${target} make install
   99     if [ $? -ne 0 ]; then
  100         return
  101     fi
  102 }
  103 
  104 function buildit {
  105     local host=$1
  106     local march=$2
  107     local usizebits=$3
  108     local offsetbits=$4
  109     local cargs=$5
  110     local afl=$6
  111     local BM="${host}${march}"
  112     local USECC="${CC}"
  113     local USECXX="${CXX}"
  114     local LIBBM="${BM}"
  115 
  116     if [ "${afl}" = "1" ]; then
  117     USECC="afl-gcc"
  118     USECXX="afl-g++"
  119     BM="${BM}-afl"
  120     fi
  121 
  122     local D="build/${BM}/usize${usizebits}/xoff${offsetbits}"
  123     local BMD="${BM}-${usizebits}-${offsetbits}"
  124 
  125     local FULLD="${SRCDIR}/${D}"
  126     local CFLAGS="${march} ${cargs} -I${SRCDIR}/build/lib-${LIBBM}/include"
  127     local CXXFLAGS="${march} ${cargs} -I${SRCDIR}/build/lib-${LIBBM}/include"
  128     local CPPFLAGS="-I${SRCDIR}/build/lib-${LIBBM}/include"
  129     local LDFLAGS="${march} -L${SRCDIR}/build/lib-${LIBBM}/lib"
  130 
  131     mkdir -p ${D}
  132 
  133     echo "  ... ${BMD}"
  134     
  135     cat >> Makefile.test <<EOF
  136 
  137 # ${BMD}
  138 # ${CFLAGS}
  139 .PHONY: build-${BMD}
  140 build-${BMD}:
  141     (cd ${D} && make all && make install)
  142 
  143 .PHONY: clean-${BMD}
  144 clean-${BMD}:
  145     (cd ${D} && make clean)
  146 
  147 .PHONY: regtest-${BMD}
  148 regtest-${BMD}:
  149     (cd ${D} && ./xdelta3regtest 1> \${TMP}/regtest.${BMD}.stdout 2> \${TMP}/regtest.${BMD}.stderr)
  150 
  151 .PHONY: selftest-${BMD}
  152 selftest-${BMD}:
  153     (cd ${D} && ./bin/xdelta3 test 1> \${TMP}/selftest.${BMD}.stdout 2> \${TMP}/selftest.${BMD}.stderr)
  154 
  155 
  156 EOF
  157 
  158     case ${host} in
  159     *linux*)
  160         LINUXTGTS="${LINUXTGTS} build-${BMD}"
  161         LINUXTEST1="${LINUXTEST1} selftest-${BMD}"
  162         LINUXTEST2="${LINUXTEST2} regtest-${BMD}"
  163         ;;
  164     *mingw*)
  165         WINTGTS="${WINTGTS} build-${BMD}"
  166         WINTEST1="${WINTEST1} selftest-${BMD}"
  167         WINTEST2="${WINTEST2} regtest-${BMD}"
  168         ;;
  169     *apple*)
  170         OSXTGTS="${OSXTGTS} build-${BMD}"
  171         OSXTEST1="${OSXTEST1} selftest-${BMD}"
  172         OSXTEST2="${OSXTEST2} regtest-${BMD}"
  173         ;;
  174     esac
  175     CLEAN="${CLEAN} clean-${BMD}"
  176 
  177     try configure-xdelta ${FULLD} ${SRCDIR}/configure \
  178               --host=${host} \
  179               --prefix=${FULLD} \
  180               --enable-static \
  181               --disable-shared \
  182               --enable-debug-symbols \
  183           "CFLAGS=${CFLAGS}" \
  184           "CXXFLAGS=${CXXFLAGS}" \
  185           "CPPFLAGS=${CPPFLAGS}" \
  186           "LDFLAGS=${LDFLAGS}" \
  187           "CC=${USECC}" \
  188           "CXX=${USECXX}"
  189     if [ $? -ne 0 ]; then
  190     return
  191     fi
  192 
  193     # try build-xdelta ${FULLD} make ${MAKEFLAGS} all
  194     # if [ $? -ne 0 ]; then
  195     #   return
  196     # fi
  197 
  198     # try install-xdelta ${FULLD} make install
  199 }
  200 
  201 function buildall {
  202     echo ""
  203     echo "Host $1$2 afl=$4"
  204     echo ""
  205 
  206     buildlzma "$1" "$2"
  207     buildit "$1" "$2" 32 32 "-DXD3_USE_LARGESIZET=0 -DXD3_USE_LARGEFILE64=0 $3" "$4"
  208     buildit "$1" "$2" 32 64 "-DXD3_USE_LARGESIZET=0 -DXD3_USE_LARGEFILE64=1 $3" "$4"
  209     buildit "$1" "$2" 64 64 "-DXD3_USE_LARGESIZET=1 -DXD3_USE_LARGEFILE64=1 $3" "$4"
  210 }
  211 
  212 setup
  213 
  214 try untar-lzma ${BUILDDIR} tar -xvf "${LZMA_FILE}"
  215 if [ $? -ne 0 ]; then
  216     exit $?
  217 fi
  218 
  219 cat > Makefile.test <<EOF
  220 # Auto-generated ${DATE} -*- Mode: Makefile -*-
  221 TMP = ${XTMP}
  222 
  223 all: linux windows apple
  224 
  225 EOF
  226 
  227 # Native compiles
  228 if [ "${MYOS}" == "Linux" ]; then
  229     # Linux
  230     buildall x86_64-pc-linux-gnu -m32 "${NONWIN_CFLAGS}" "0"
  231     buildall x86_64-pc-linux-gnu -m32 "${NONWIN_CFLAGS}" "1"
  232     buildall x86_64-pc-linux-gnu -m64 "${NONWIN_CFLAGS}" "0"
  233     buildall x86_64-pc-linux-gnu -m64 "${NONWIN_CFLAGS}" "1"
  234 fi
  235 
  236 if [ "${MYOS}" == "Darwin" ]; then
  237     # OS X
  238     buildall x86_64-apple-darwin -m32 "${NONWIN_CFLAGS}" "0"
  239     buildall x86_64-apple-darwin -m64 "${NONWIN_CFLAGS}" "0"
  240 fi
  241 
  242 # Cross compile
  243 buildall i686-w64-mingw32 -mconsole "${MINGW_CFLAGS}" "0"
  244 buildall x86_64-w64-mingw32 -mconsole "${MINGW_CFLAGS}" "0"
  245 
  246 cat >> Makefile.test <<EOF
  247 
  248 clean: ${CLEAN}
  249 
  250 .PHONY: linux windows apple
  251 .PHONY: linux-build windows-build apple-build
  252 .PHONY: linux-selftest windows-selftest apple-selftest
  253 .PHONY: linux-regtest windows-regtest apple-regtest
  254 
  255 linux: linux-build linux-selftest linux-regtest
  256 windows: windows-build windows-selftest windows-regtest
  257 apple: apple-build apple-selftest apple-regtest
  258 
  259 linux-build: ${LINUXTGTS}
  260 linux-selftest: ${LINUXTEST1}
  261 linux-regtest: ${LINUXTEST2}
  262 
  263 windows-build: ${WINTGTS}
  264 windows-selftest: ${WINTEST1}
  265 windows-regtest: ${WINTEST2}
  266 
  267 apple-build: ${OSXTGTS}
  268 apple-selftest: ${OSXTEST1}
  269 apple-regtest: ${OSXTEST2}
  270 
  271 EOF