Ticket #11170: mythbuild.diff

File mythbuild.diff, 15.1 KB (added by Lawrence Rust <lvr@…>, 12 years ago)
  • Win32/mythbuild.sh

    diff --git a/Win32/mythbuild.sh b/Win32/mythbuild.sh
    index 4fb21c6..5ae55ba 100755
    a b else 
    230230    cpus=1
    231231fi
    232232[ $cpus -gt 1 ] && makejobs=`expr $cpus + 1` || makejobs=1
    233 verbose="no"
     233: ${MYTHVERBOSE:=no}
     234export MYTHVERBOSE
    234235unset dosudo
    235236unset patchmaster
    236237: ${DXVA2:="no"}
     238: ${X264:="yes"} # Enable x264 for mythffmpeg transcoding
     239PROFILE="no"
    237240
    238241
    239242###############################################################
    function myhelp() { 
    257260    echo "  -b tag        Checkout MythTV branch [$branch]"
    258261    echo "  -r           *Release build (sticky)"
    259262    echo "  -d            Debug build (sticky)"
    260     echo "  -p            Profile build (sticky)"
     263    echo "  -p            Build for gprof profiling (sticky) [$PROFILE]"
    261264    echo "  -I <path>     Install prefix [${MYTHINSTALL#$MYTHDIR/}]"
    262265    echo "  -H            Build for Host (sticky)"
    263266    echo "  -M            Build for MacOSX-i686 (32-bit) (sticky)"
    function myhelp() { 
    267270    echo "  -c <cpu>      Set target CPU (host|i?86|...) [$cpu]"
    268271    echo "  -j n          Number of parallel make jobs [$makejobs]"
    269272    echo "  -t <n>        Timeout after configure [$readtimeout Seconds]"
    270     echo "  -v            Verbose build messages [$verbose]"
     273    echo "  -v            Verbose build messages [$MYTHVERBOSE]"
    271274    echo "  -C            Force a clean re-build"
    272275    echo "  -E            Force a clean re-install"
    273276    echo "  -F            Enable mythtv and mythplugins master patches [${patchmaster:-no}]"
    function myhelp() { 
    284287    echo "MYTHPATCHES     Patches to apply [$MYTHPATCHES]"
    285288    echo "MYTHVER         MythTV version [$MYTHVER]"
    286289    echo "DXVA2           Windows DXVA2 support [$DXVA2]"
     290    echo "X264            libx264 support for transcoding and HLS [$X264]"
    287291    echo "MYTHGIT         Myth git repository [$MYTHGIT]"
    288292    echo "MYTHREPO        Primary mirror [$MYTHREPO]"
    289293    echo "SOURCEFORGE     Sourceforge mirror [$SOURCEFORGE]"
    do 
    314318        b) [ "${OPTARG:0:1}" != "-" ] && MYTHBRANCH=$OPTARG || die "Invalid branch tag: $OPTARG" ;;
    315319        c) [ "${OPTARG:0:1}" != "-" ] && cpu=$OPTARG || die "Invalid CPU: $OPTARG" ;;
    316320        d) MYTHBUILD="debug" ;;
    317         p) MYTHBUILD="profile" ;;
     321        p) PROFILE="yes" ;;
    318322        r) MYTHBUILD="release" ;;
    319323        j) [ $OPTARG -lt 0 -o $OPTARG -gt 99 ] && die "Invalid number of jobs: $OPTARG"
    320324           [ $OPTARG -lt 1 ] && die "Invalid make jobs: $OPTARG"
    321325            makejobs=$OPTARG ;;
    322326        t) [ $OPTARG \< 0 -o $OPTARG -gt 999 ] && die "Invalid timeout: $OPTARG"
    323327            readtimeout=$OPTARG ;;
    324         v) verbose="yes" ;;
     328        v) MYTHVERBOSE="yes" ;;
    325329        l) logging="yes" ;;
    326330        C) cleanbuild="yes" ;;
    327331        E) reinstall="yes" ;;
    function dumpenv() { 
    611615    echo ""
    612616
    613617    local param param1="MYTHTARGET MYTHBUILD MYTHBRANCH readtimeout logging patches"
    614     local param2="cleanbuild reconfig reinstall cpu cpus makejobs verbose dosudo themes patchmaster"
     618    local param2="cleanbuild reconfig reinstall cpu cpus makejobs MYTHVERBOSE dosudo themes patchmaster"
    615619    for param in $param1 $param2 ; do
    616620        echo "$param=${!param}"
    617621    done
    function isWinTarget() { 
    644648    return 1
    645649}
    646650
     651# Print and execute a command
     652function Show() {
     653    echo "$*"
     654    "$@"
     655}
     656
    647657
    648658###############################################################
    649659# Installation check
    if [ "$MYTHTARGET" != "Host" -a "$MSYSTEM" != "MINGW32" ]; then 
    753763        *) die "Unhown target: $MYTHTARGET" ;;
    754764    esac
    755765fi
     766#[ -n "$bprefix" ] && echo "BUILD=$bprefix" >&2
     767
     768
     769# Detect cross compiler
     770if [ -n "$xprefix" ]; then
     771    :
     772elif isWinTarget && [ "$MSYSTEM" != "MINGW32" ]; then
     773    # Cross compiling to Windows
     774    # Ubuntu 10.10
     775    if which i586-mingw32msvc-gcc >/dev/null 2>&1 ; then
     776        xprefix="i586-mingw32msvc"
     777    # Mandriva 2010.2 (32 bit)
     778    elif which i586-pc-mingw32-gcc >/dev/null 2>&1 ; then
     779        xprefix="i586-pc-mingw32"
     780    # Fedora 14
     781    elif which i686-pc-mingw32-gcc >/dev/null 2>&1 ; then
     782        xprefix="i686-pc-mingw32"
     783    elif xcc=`locate "/usr/bin/*mingw32*-gcc" 2>/dev/null` ; then
     784        xprefix=`basename "${xcc%-gcc}"`
     785    else
     786        die "mingw is required for cross compiling to Windows.\n"\
     787            "Try: sudo apt-get install mingw32\n"\
     788            "Or: sudo yum install mingw32-gcc.i686 mingw32-g++.i686"
     789    fi
     790elif [ "$MYTHTARGET" = "MacOSX-i686" ]; then
     791    # Cross compiling to MacOSX
     792    for xprefix in i686-apple-darwin11 i686-apple-darwin10 i686-apple-darwin9 i686-apple-darwin8 ; do
     793        which "$xprefix-gcc" >/dev/null 2>&1 && break
     794    done
     795elif [ "$MYTHTARGET" = "MacOSX-PPC" ]; then
     796    # Cross compiling to MacOSX
     797    for xprefix in powerpc-apple-darwin10 powerpc-apple-darwin9 powerpc-apple-darwin8 powerpc-apple-darwin7 ; do
     798        which "$xprefix-gcc" >/dev/null 2>&1 && break
     799    done
     800fi
     801#[ -n "$xprefix" ] && echo "HOST=$xprefix" >&2
    756802
    757803
    758804# Redirect output to log file as if invoked by: mythbuild.sh 2>&1 | tee -a mythbuild.log
    make --version >/dev/null 2>&1 || install_pkg make 
    855901gcc --version >/dev/null 2>&1 || install_pkg gcc
    856902g++ --version >/dev/null 2>&1 || install_pkg g++
    857903
    858 if isWinTarget && [ "$MSYSTEM" != "MINGW32" ]; then
    859     # Cross compiling to Windows
    860     if [ -z "$xprefix" ]; then
    861         # Ubuntu 10.10
    862         if which i586-mingw32msvc-gcc >/dev/null 2>&1 ; then
    863             xprefix="i586-mingw32msvc"
    864         # Mandriva 2010.2 (32 bit)
    865         elif which i586-pc-mingw32-gcc >/dev/null 2>&1 ; then
    866             xprefix="i586-pc-mingw32"
    867         # Fedora 14
    868         elif which i686-pc-mingw32-gcc >/dev/null 2>&1 ; then
    869             xprefix="i686-pc-mingw32"
    870         elif xcc=`locate "/usr/bin/*mingw32*-gcc" 2>/dev/null` ; then
    871             xprefix=`basename "${xcc%-gcc}"`
    872         else
    873             die "mingw is required for cross compiling to Windows.\n"\
    874                 "Try: sudo apt-get install mingw32\n"\
    875                 "Or: sudo yum install mingw32-gcc.i686 mingw32-g++.i686"
    876         fi
    877     fi
    878 elif [ "$MYTHTARGET" = "MacOSX-i686" ]; then
    879     # Cross compiling to MacOSX
    880     for xprefix in i686-apple-darwin11 i686-apple-darwin10 i686-apple-darwin9 i686-apple-darwin8 ; do
    881         which "$xprefix-gcc" >/dev/null 2>&1 && break
    882     done
    883 elif [ "$MYTHTARGET" = "MacOSX-PPC" ]; then
    884     # Cross compiling to MacOSX
    885     for xprefix in powerpc-apple-darwin10 powerpc-apple-darwin9 powerpc-apple-darwin8 powerpc-apple-darwin7 ; do
    886         which "$xprefix-gcc" >/dev/null 2>&1 && break
    887     done
    888 fi
    889904# Check the C/C++ cross compilers exist
    890905if [ -n "$xprefix" ]; then
    891906    # Check the C/C++ cross compilers exist
    function build() { 
    12541269    if [ ! -e "$stampconfigtag" -o -n "${!libcfg}" -o ! -e "Makefile" ]; then
    12551270        rm -f "$stampconfigtag"
    12561271        [ -e Makefile ] && make_distclean || true
    1257         set -x
    1258         ./configure "--prefix=$MYTHINSTALL" ${xprefix:+--host=$xprefix} \
     1272        Show ./configure "--prefix=$MYTHINSTALL" ${xprefix:+--host=$xprefix} \
    12591273            ${bprefix:+--build=$bprefix} $debugflag "$@" ${!libcfg}
    1260         set +x
    12611274        # Call post-config function if defined
    12621275        local libpost=${lib}_POST
    12631276        local libpostv=${!libpost}
    if isWinTarget ; then 
    12971310    dopatches "$name" || rm -f Makefile
    12981311    if [ ! -e Makefile ]; then
    12991312        cp -f win32/Makefile.gcc Makefile
    1300         set -x
    1301         $make ${xprefix:+CC=$xprefix-gcc} \
     1313        Show $make ${xprefix:+CC=$xprefix-gcc} \
    13021314            ${xprefix:+AR=$xprefix-ar} \
    13031315            ${xprefix:+RC=$xprefix-windres} \
    13041316            LOCAL_UNZIP="-DCHEAP_SFX_AUTORUN" \
    13051317            guisfx
    1306         set +x
    13071318    fi
    13081319    popd >/dev/null
    13091320fi
    if [ ! -e "$stampconfig.$debug" -o -n "${!compcfg}" -o ! -e Makefile ]; then 
    18771888
    18781889    if [ "$MSYSTEM" = "MINGW32" ]; then
    18791890        args="$args -I $incdir/mysql -L `pwd -W`/../$MYSQLW/lib/opt -l mysql"
    1880         set -x
    1881         cmd /c "configure.exe $args ${!compcfg}"
    1882         set +x
     1891        Show cmd /c "configure.exe $args ${!compcfg}"
    18831892    else
    18841893        # Disable unused XmlPatterns to speed up build
    18851894        args="$args -no-javascript-jit -no-xmlpatterns"
    if [ ! -e "$stampconfig.$debug" -o -n "${!compcfg}" -o ! -e Makefile ]; then 
    19331942            ;;
    19341943        esac
    19351944
    1936         set -x
    1937         ./configure -prefix $MYTHINSTALL $args ${!compcfg}
    1938         set +x
     1945        Show ./configure -prefix $MYTHINSTALL $args ${!compcfg}
    19391946    fi
    19401947    pausecont
    19411948    touch "$stampconfig.$debug"
    if [ ! -e "$precis" ]; then 
    20572064        EOF
    20582065fi
    20592066
     2067# Configure
    20602068pushd "$name" >/dev/null
    20612069[ "$reconfig" = "yes" ] && rm -f $stampconfig*
    20622070if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHTV_CFG" \
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHTV_CFG" \ 
    20722080    # liblibmythav... are left in lib
    20732081    $dosudo rm -f $libdir/lib*myth*
    20742082
     2083    # NB avfilter required for ffmpeg
    20752084    args="--sysinclude=$incdir \
    20762085        --extra-cflags=-I$incdir --extra-cxxflags=-I$incdir --extra-libs=-L$libdir \
    2077         --disable-avdevice --disable-avfilter \
     2086        --extra-cflags=-Wuninitialized --extra-cxxflags=-Wuninitialized \
     2087        --disable-avdevice \
    20782088        --enable-libfftw3 --disable-joystick-menu"
    20792089    case "$MYTHVER" in
    20802090        0.23*) args="$args --disable-directfb" ;;
    20812091        0.24*) args="$args --disable-directfb --enable-vaapi" ;;
    2082         ""|0.25*|master) args="$args --enable-vaapi" ;;
     2092        *) args="$args --enable-vaapi" ;;
    20832093    esac
    20842094    rprefix=".."
    20852095    case "$MYTHTARGET" in
    20862096        [Hh]ost)
    20872097            targetos=""
    2088             # Enable x264 for mythffmpeg transcoding
    2089             args="$args --enable-libx264 --enable-libmp3lame"
     2098            case "$X264" in
     2099                yes|y|YES|Y|1) args="$args --enable-libx264" ;;
     2100            esac
     2101            args="$args --enable-libmp3lame"
    20902102        ;;
    20912103        [Ww]indows)
    20922104            targetos="mingw32"
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHTV_CFG" \ 
    21132125        *) die "Unknown target: $MYTHTARGET" ;;
    21142126    esac
    21152127
    2116     set -x
    2117     ./configure "--prefix=$MYTHINSTALL" "--runprefix=$rprefix" \
     2128    Show ./configure "--prefix=$MYTHINSTALL" "--runprefix=$rprefix" \
    21182129        "--qmake=$MYTHWORK/$QT/bin/qmake" \
    21192130        ${xprefix:+--enable-cross-compile} \
    21202131        ${xprefix:+--cross-prefix=$xprefix-} \
    21212132        ${targetos:+--target_os=$targetos} \
    21222133        ${arch:+--arch=$arch} ${cpu:+--cpu=$cpu} \
    21232134        $args --compile-type=$MYTHBUILD $MYTHTV_CFG
    2124     set +x
    21252135
    21262136    case "$MYTHTARGET" in
    21272137        [Hh]ost)
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHTV_CFG" \ 
    21302140        ;;
    21312141    esac
    21322142
     2143    # gprof options
     2144    [ "$PROFILE" = "yes" ] && cat >> config.mak <<-EOF
     2145                QMAKE_CFLAGS+="-pg"
     2146                QMAKE_CXXFLAGS+="-pg"
     2147                QMAKE_LFLAGS+="-pg"
     2148        EOF
     2149
    21332150    # This quietens the build noise but is irreversible
    21342151    #cat >> config.mak <<< CCONFIG+=silent
    21352152
    function helpmyth() { 
    21572174    exit 1
    21582175}
    21592176
    2160 [ "$verbose" = "no" ] && make="$make -s"
    2161 : ${MYTHVERBOSE:=$verbose}
    2162 $make || helpmyth
     2177[ "$MYTHVERBOSE" = "no" ] && make="$make -s" || export V=1
     2178$make $MYTHMAKEFLAGS || helpmyth
    21632179
    21642180banner "Installing $name ($MYTHBUILD)"
    21652181make_install
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHPLUGINS_CFG" \ 
    21802196    plugins="--enable-all --enable-fftw"
    21812197    case "$MYTHVER" in
    21822198        0.23*|0.24*) plugins="$plugins --enable-libvisual" ;;
    2183         ""|0.25*|master) ;;
    21842199    esac
    21852200
    21862201    if ! isdebug QT ; then
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHPLUGINS_CFG" \ 
    21892204        [ "$MYTHNETVISION" = "yes" ] || plugins="$plugins --disable-mythnetvision"
    21902205        case "$MYTHVER" in
    21912206            ""|0.23*|0.24*) [ "$MYTHWEATHER" = "yes" ] || plugins="$plugins --disable-mythweather" ;;
    2192             0.25*|master) ;;
    21932207        esac
    21942208    fi
    21952209
    if [ ! -e "$stampconfig${MYTHBUILD:+.$MYTHBUILD}" -o -n "$MYTHPLUGINS_CFG" \ 
    22112225        ;;
    22122226    esac
    22132227
    2214     set -x; ./configure $args $plugins $MYTHPLUGINS_CFG ; set +x
     2228    Show ./configure $args $plugins $MYTHPLUGINS_CFG
    22152229    pausecont
    22162230    touch "$stampconfig${MYTHBUILD:+.$MYTHBUILD}"
    22172231fi
    fi 
    22802294###############################################################################
    22812295# Create the installation
    22822296###############################################################################
    2283 mythlibs="myth mythfreemheg mythtv mythui mythupnp mythlivemedia"
     2297mythlibs="myth mythfreemheg mythlivemedia mythtv mythui mythupnp"
    22842298if [ -z "$MYTHVER" ]; then
    22852299    case "$branch" in
    22862300        *-master) MYTHVER="master" ;;
    22872301        *-0*24)   MYTHVER="0.24" ;;
    22882302        *-0*25)   MYTHVER="0.25" ;;
     2303        *-0*26)   MYTHVER="0.26" ;;
    22892304    esac
    22902305fi
    22912306case "$MYTHVER" in
    2292     0.23*)        mythlibs="$mythlibs mythdb" ;;
    2293     0.24*)        mythlibs="$mythlibs mythdb mythmetadata" ;;
    2294     0.25*|master) mythlibs="$mythlibs mythbase mythmetadata mythservicecontracts mythprotoserver" ;;
    2295     *)            mythlibs="$mythlibs mythbase mythmetadata mythservicecontracts mythprotoserver"
    2296                   echo "WARNING Installation untested with this version." ;;
     2307    0.23*)  mythlibs="$mythlibs mythdb" ;;
     2308    0.24*)  mythlibs="$mythlibs mythdb mythmetadata" ;;
     2309    0.25*)  mythlibs="$mythlibs mythbase mythmetadata mythservicecontracts mythprotoserver" ;;
     2310    0.26*)  mythlibs="$mythlibs mythbase mythmetadata mythnzmqt mythprotoserver mythqjson mythservicecontracts mythzmq" ;;
     2311    *)      echo "WARNING mythtv nstallation untested with this version." ;&
     2312    master) mythlibs="$mythlibs mythbase mythmetadata mythnzmqt mythprotoserver mythqjson mythservicecontracts mythzmq" ;;
    22972313esac
     2314
    22982315ffmpeglibs="mythavcodec mythavformat mythavutil mythswscale"
    22992316case "$MYTHVER" in
    2300     0.24*|0.23*)     ffmpeglibs="$ffmpeglibs mythavcore mythpostproc" ;;
    2301     0.25*|master|"") ffmpeglibs="$ffmpeglibs mythpostproc" ;;
     2317    0.24*|0.23*)    ffmpeglibs="$ffmpeglibs mythavcore mythpostproc" ;;
     2318    0.25*)          ffmpeglibs="$ffmpeglibs mythpostproc" ;;
     2319    0.26*)          ffmpeglibs="$ffmpeglibs mythavfilter mythpostproc mythswresample" ;;
     2320    *)              echo "WARNING ffmpeg installation untested with this version." ;&
     2321    master)         ffmpeglibs="$ffmpeglibs mythavfilter mythpostproc mythswresample" ;;
    23022322esac
     2323
    23032324xtralibs="xml2 xslt freetype mp3lame dvdcss exif ogg vorbis vorbisenc tag cdio cdio_cdda cdio_paranoia udf visual-0.4"
    23042325QTDLLS="QtCore QtGui QtNetwork QtOpenGL QtSql QtSvg QtWebKit QtXml Qt3Support"
    23052326case "$MYTHVER" in
    2306     ""|0.25*|master) QTDLLS="$QTDLLS QtScript" ;;
     2327    0.2[0-4]*) ;;
     2328    *) QTDLLS="$QTDLLS QtScript" ;;
    23072329esac
    23082330
    23092331if isWinTarget ; then
    if isWinTarget ; then 
    23162338    ln -s $bindir/myth*.exe .
    23172339    [ -r "$bindir/mtd.exe" ] && ln -s $bindir/mtd.exe .
    23182340    for lib in $mythlibs ; do
    2319         ln -s $bindir/lib$lib-*.dll .
     2341        if [ -e $bindir/lib$lib-*.dll ] ; then
     2342            ln -s $bindir/lib$lib-*.dll .
     2343        elif [ -e $bindir/lib$lib.dll ] ; then
     2344            ln -s $bindir/lib$lib.dll .
     2345        elif [ -e $bindir/$lib.dll ] ; then
     2346            ln -s $bindir/$lib.dll .
     2347        fi
    23202348    done
    23212349
    23222350    # Mingw runtime