Ticket #8742: configure-engines.patch

File configure-engines.patch, 8.2 KB (added by jvprat, 17 years ago)
  • configure

     
    4949_build_hq_scalers=yes
    5050_build_scalers=yes
    5151
    52 _engines='
    53 scumm
    54 scumm_7_8
    55 he
    56 agi
    57 agos
    58 cine
    59 cruise
    60 drascula
    61 gob
    62 igor
    63 kyra
    64 lure
    65 parallaction
    66 queen
    67 saga
    68 sky
    69 sword1
    70 sword2
    71 touche
    72 '
    73 _engine_scumm_name="SCUMM"
    74 _engine_scumm_build=yes
    75 _engine_scumm_check=check_scumm_build
    76 _engine_scumm_7_8_name="v7 and v8 games (ft, dig, comi and demos) in SCUMM"
    77 _engine_scumm_7_8_build=yes
    78 _engine_scumm_7_8_sub=yes
    79 _engine_he_name="HE70+ games in SCUMM"
    80 _engine_he_build=yes
    81 _engine_he_sub=yes
    82 _engine_agi_name="AGI"
    83 _engine_agi_build=yes
    84 _engine_agos_name="AGOS"
    85 _engine_agos_build=yes
    86 _engine_cine_name="Cinematique evo 1"
    87 _engine_cine_build=yes
    88 _engine_cruise_name="Cinematique evo 2"
    89 _engine_cruise_build=no
    90 _engine_drascula_name="Drascula: The Vampire Strikes Back"
    91 _engine_drascula_build=no
    92 _engine_gob_name="Gobli*ns"
    93 _engine_gob_build=yes
    94 _engine_igor_name="Igor: Objective Uikokahonia"
    95 _engine_igor_build=no
    96 _engine_kyra_name="Legend of Kyrandia"
    97 _engine_kyra_build=yes
    98 _engine_lure_name="Lure of the Temptress"
    99 _engine_lure_build=yes
    100 _engine_parallaction_name="Parallaction"
    101 _engine_parallaction_build=yes
    102 _engine_queen_name="Flight of the Amazon Queen"
    103 _engine_queen_build=yes
    104 _engine_saga_name="SAGA"
    105 _engine_saga_build=yes
    106 _engine_sky_name="Beneath a Steel Sky"
    107 _engine_sky_build=yes
    108 _engine_sword1_name="Broken Sword 1"
    109 _engine_sword1_build=yes
    110 _engine_sword1_check=check_sword_build
    111 _engine_sword2_name="Broken Sword 2"
    112 _engine_sword2_build=yes
    113 _engine_sword2_check=check_sword_build
    114 _engine_touche_name="Touche: The Adventures of the Fifth Musketeer"
    115 _engine_touche_build=yes
     52# Add an engine: id name build subengines
     53add_engine() {
     54        _engines="${_engines} ${1}"
     55        eval _engine_${1}_name='${2}'
     56        eval _engine_${1}_build='${3}'
     57        eval _engine_${1}_subengines='${4}'
     58        for sub in ${4}; do
     59                eval _engine_${sub}_sub=yes
     60        done
     61}
    11662
     63add_engine scumm "SCUMM" yes "scumm_7_8 he"
     64add_engine scumm_7_8 "v7 & v8 games" yes
     65add_engine he "HE70+ games" yes
     66add_engine agi "AGI" yes
     67add_engine agos "AGOS" yes
     68add_engine cine "Cinematique evo 1" yes
     69add_engine cruise "Cinematique evo 2" no
     70add_engine drascula "Drascula: The Vampire Strikes Back" no
     71add_engine gob "Gobli*ns" yes
     72add_engine igor "Igor: Objective Uikokahonia" no
     73add_engine kyra "Legend of Kyrandia" yes
     74add_engine lure "Lure of the Temptress" yes
     75add_engine parallaction "Parallaction" yes
     76add_engine queen "Flight of the Amazon Queen" yes
     77add_engine saga "SAGA" yes
     78add_engine sky "Beneath a Steel Sky" yes
     79add_engine sword1 "Broken Sword 1" yes
     80add_engine sword2 "Broken Sword 2" yes
     81add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes
     82
    11783_endian=unknown
    11884_need_memalign=no
    11985_have_x86=no
     
    359325        eval echo \$_engine_$1_build
    360326}
    361327
     328# Get the subengines
     329get_engine_subengines() {
     330        eval echo \$_engine_$1_subengines
     331}
     332
    362333# Ask if this is a subengine
    363334get_engine_sub() {
    364335        sub=`eval echo \\$_engine_$1_sub`
    365         if test "$sub" = "" ; then
     336        if test -z "$sub" ; then
    366337                sub=no
    367338        fi
    368339        echo $sub
     
    388359        fi
    389360}
    390361
     362# Show the configure help line for an option
     363option_help() {
     364        option=`echo "--$(echo $1 | sed 's/_/-/g')                       " | head -c 23`
     365        echo "  ${option}  ${2}"
     366}
     367
    391368# Show the configure help line for a given engine
    392369show_engine_help() {
    393370        if test `get_engine_build $1` = yes ; then
     
    397374                option="enable"
    398375                do=""
    399376        fi
    400         option=`echo "--${option}-$(echo $1 | sed 's/_/-/g')                       " | head -c 23`
    401377        name=`get_engine_name $1`
    402         echo "  ${option}  ${do}build the ${name} engine"
     378        option_help ${option}-${1} "${do}build the ${name} engine"
     379        for sub in `get_engine_subengines $1`; do
     380                show_subengine_help $sub $1
     381        done
    403382}
    404383
    405 check_engine_build() {
    406         check=`eval echo \\$_engine_$1_check`
    407         if test "$check" = "" ; then
    408                 name=`get_engine_name $1`
    409                 if test `get_engine_build $1` = yes ; then
    410                         _engines_built="${_engines_built}#$name@"
    411                 else
    412                         _engines_skipped="${_engines_skipped}#$name@"
    413                 fi
     384# Show the configure help line for a given subengine
     385show_subengine_help() {
     386        if test `get_engine_build $1` = yes ; then
     387                option="disable"
     388                do="exclude"
    414389        else
    415                 $check $1
     390                option="enable"
     391                do="include"
    416392        fi
     393        name=`get_engine_name $1`
     394        parent=`get_engine_name $2`
     395        option_help ${option}-${1} "${do} the ${name} in ${parent} engine"
    417396}
    418397
    419 check_sword_build() {
    420         name=`get_engine_name $1`
    421         if test `get_engine_build $1` = yes ; then
    422                 _engines_built="${_engines_built}#$name"
    423                 if test "$_mpeg2" = yes ; then
    424                         _engines_built="${_engines_built} (w/ mpeg2 cutscenes)"
     398# Prepare the strings about the engines to build
     399prepare_engine_build_strings() {
     400        string_yes=`get_engine_build_string $1 yes`
     401        if test -n "$string_yes" ; then
     402                _engines_built="${_engines_built}#$string_yes@"
     403        fi
     404
     405        string_no=`get_engine_build_string $1 no`
     406        if test -n "$string_no" ; then
     407                _engines_skipped="${_engines_skipped}#$string_no@"
     408        fi
     409}
     410
     411# Get the string about building an engine
     412get_engine_build_string() {
     413        engine_string=""
     414        if test `get_engine_build $1` = no ; then
     415                if test $2 = no ; then
     416                        engine_string=`get_engine_name $1`
    425417                else
    426                         _engines_built="${_engines_built} (without mpeg2 cutscenes)"
     418                        engine_string=""
    427419                fi
    428                 _engines_built="${_engines_built}@"
    429420        else
    430                 _engines_skipped="${_engines_skipped}#$name@"
     421                build_string_func=get_${1}_build_string
     422                if ( type $build_string_func | grep function ) 2> /dev/null > /dev/null ; then
     423                        engine_string=`$build_string_func $1 $2`
     424                else
     425                        engine_string=`get_subengines_build_string $1 $2`
     426                fi
     427
     428                if test $2 = yes ; then
     429                        engine_string="`get_engine_name $1` $engine_string"
     430                else
     431                        if test -n "$engine_string" ; then
     432                                engine_string="`get_engine_name $1` $engine_string"
     433                        fi
     434                fi
    431435        fi
     436
     437        echo $engine_string
    432438}
    433439
    434 check_scumm_build() {
    435         name=`get_engine_name $1`
    436 
    437         if test `get_engine_build $1` = yes ; then
    438                 _engines_built="${_engines_built}#$name [v0-v6 games]"
    439 
    440                 if test "$_engine_scumm_7_8_build" = yes ; then
    441                         _engines_built="${_engines_built} [v7 & v8 games]"
     440# Get the string about building subengines
     441get_subengines_build_string() {
     442        all=yes
     443        subengine_string=$3
     444        for subeng in `get_engine_subengines $1` ; do
     445                if test `get_engine_build $subeng` = $2 ; then
     446                        subengine_string="$subengine_string [`get_engine_name $subeng`]"
    442447                else
    443                         skip=" [v7 & v8 games]"
     448                        all=no
    444449                fi
    445                 if test "$_engine_he_build" = yes ; then
    446                         _engines_built="${_engines_built} [HE70+ games]"
    447                 else
    448                         skip="$skip [HE70+ games]"
     450        done
     451        if test $2 = yes ; then
     452                if test -n "$subengine_string" ; then
     453                        if test $all = yes ; then
     454                                subengine_string="[all games]"
     455                        fi
    449456                fi
     457        fi
    450458
    451                 if test "$skip" = "" ; then
    452                         true
     459        echo $subengine_string
     460}
     461
     462# Engine specific build strings
     463get_sword1_build_string() {
     464        if test $2 = yes ; then
     465                if test "$_mpeg2" = yes ; then
     466                        echo "(w/ mpeg2 cutscenes)"
    453467                else
    454                         _engines_skipped="$_engines_skipped#$name$skip@"
     468                        echo "(without mpeg2 cutscenes)"
    455469                fi
     470        fi
     471}
    456472
    457                 _engines_built="${_engines_built}@"
    458         else
    459                 _engines_skipped="${_engines_skipped}#$name [all games]@"
     473get_sword2_build_string() {
     474        get_sword1_build_string $1 $2
     475}
     476
     477get_scumm_build_string() {
     478        if test $2 = yes ; then
     479                base="[v0-v6 games]"
    460480        fi
     481        get_subengines_build_string $1 $2 "$base"
    461482}
    462483
    463484#
     
    479500for parm in "$@" ; do
    480501        if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then
    481502                for engine in $_engines; do
    482                         engines_help="$engines_help`show_engine_help $engine`
     503                        if test `get_engine_sub $engine` = no ; then
     504                                engines_help="$engines_help`show_engine_help $engine`
    483505"
     506                        fi
    484507                done
    485508                cat << EOF
    486509
     
    14521475
    14531476for engine in $_engines; do
    14541477        if test "`get_engine_sub $engine`" = "no" ; then
    1455                 check_engine_build $engine
     1478                prepare_engine_build_strings $engine
    14561479        fi
    14571480done
    14581481
    14591482echo
    1460 if test "$_engines_built" = "" ; then
    1461         true
    1462 else
     1483if test -n "$_engines_built" ; then
    14631484        echo "Engines:"
    14641485        echo $_engines_built | sed 's/@/\
    14651486/g
    14661487s/#/    /g'
    14671488fi
    14681489
    1469 if test "$_engines_skipped" = "" ; then
    1470         true
    1471 else
     1490if test -n "$_engines_skipped" ; then
    14721491        echo "Engines Skipped:"
    14731492        echo $_engines_skipped | sed 's/@/\
    14741493/g