Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 171 lines (140 sloc) 4.982 kb
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
#!/bin/bash

source admin/utils.bash

#################################################################### functions
fix_sln()
{
    FIRST_BIT='
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "qmake", "qmake", "{780C13D3-8172-4EE0-8FD5-26ED6489851C}"
ProjectSection(SolutionItems) = preProject'
    
    for x in `admin/findmoose pro` .qmake.cache
    do
FIRST_BIT="$FIRST_BIT
$x=$x"
    done

LAST_BIT='
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{3FDD67B7-DF67-4F22-8545-755D722794BC}"
ProjectSection(SolutionItems) = preProject
common\qrc\common.qrc = common\qrc\common.qrc
lib\DllExportMacro.h = lib\DllExportMacro.h
EndProjectSection
EndProject'

    echo "$FIRST_BIT$LAST_BIT" >> Last.sln
}


######################################################################## usage
header "Configuring Last.fm"

while [ $# -gt 0 ]
do
case "$1" in
        --debug)
            echo "The default is --debug, but let's pretend you made a difference anyway.";;
        --release)
            echo 'Will optimise and strip binaries.'
            RELEASE=1;;
--3rdparty)
svn co svn+ssh://gimli.last.fm/svn/libs/cpp lib/3rdparty
exit;;
--tests)
echo 'Will build tests'
TESTS=1
EXTRA_QMAKE_FLAGS='CONFIG += tests';;
--xcode)
echo "Will generate Xcode project"
XCODE=1;;
        --help | -h | --usage)
            echo "options include: --release, --tests, --xcode"
            exit;;
    esac
shift
done

[ $XCODE ] && [ $RELEASE ] && die 'Incompatible arguments'


QMAKE=`ruby admin/which_qmake.rb`

if [[ $QMAKE == 'toolow' ]]
then
##########################################################################80-->
echo "Your version of Qt seems to be too old, we require Qt 4.$min or above."
echo
echo "It is possible you have Qt3 and Qt4 both installed. Locate your Qt4 installation"
echo "and ensure it is placed first in the path, eg:"
echo
echo " PATH=/opt/qt4/bin:\$PATH ./configure"
echo
echo "However this configure script is very basic, perhaps we got it wrong.."
echo "Try typing the following, perhaps it will build for you :)"
echo
echo " qmake -config release && make"
exit 1
elif [[ $QMAKE == '' ]]
then
echo "Sorry, qmake was not found, is Qt4 installed?"
    exit 2
fi

echo 'Using '`which $QMAKE`

header 'Generating Build System'

middle "Running qpp..."
for x in `admin/findsrc pro.in lib` `admin/findsrc pro.in app`
do
pro=`dirname "$x"`/`basename "$x" .in`
    cp "$x" "$pro"
    echo "#### GENERATED FILE!!! Edit the pro.in file instead! ####" >> "$pro"
    admin/qpp "$x" >> "$pro"
done


middle "Running qmake..."
test -z "$PREFIX" && PREFIX=/usr/local
    
if [ $RELEASE ]
then
qmake -config release -recursive "CONFIG -= debug debug_and_release" Last.fm.pro
    which nmake &> /dev/null && BUILD_CMD='nmake' || BUILD_CMD='make'
else
case `uname` in
        Darwin)
        if [ $XCODE ]
        then
admin/qpp app/client/client.pro
            cp app/client/client.pro _client.pro
            qmake -config debug -spec macx-xcode _client.pro || exit $?
            # the only way to add the QtOverride stuff to xcodeproj bundles,
            # which suggests we should lose it
            XCODEPROJ='Last.fm.xcodeproj/project.pbxproj'
            perl -pi -e 's|HEADER_SEARCH_PATHS = \(|HEADER_SEARCH_PATHS = \( common/qt/override,|g' $XCODEPROJ
         # disable stupid recursive includes
         perl -pi -e 's|buildSettings = {|buildSettings = {\n\t\tALWAYS_SEARCH_USER_PATHS = NO;|g' $XCODEPROJ
            BUILD_CMD='open Last.fm.xcodeproj'
            rm _files.qmake _version.h
        else
            # prevent qmake interpreting "" as "."
            if [ -z "$EXTRA_QMAKE_FLAGS" ]; then
EXTRA_QMAKE_FLAGS='NOOP=""'
            fi

qmake -config debug -recursive Last.fm.pro "CONFIG -= app_bundle release" "$EXTRA_QMAKE_FLAGS" || die "Configure failed."
            BUILD_CMD='make'
        fi;;
            
        Linux)
            qmake -config debug -recursive Last.fm.pro "CONFIG += warn_off" || die "Configure failed."
            BUILD_CMD='make'
            middle "Configured to produce a _debug_ build.";;

        *)
            #svn co svn+ssh://gimli.last.fm/svn/clientside/bin/win _bin
            qmake -recursive -tp vc Last.fm.pro "CONFIG -= flat" || die "Configure failed."
            fix_sln
            BUILD_CMD='devenv /useenv Last.sln';;
    esac
fi


if [ $TESTS ]
then
cp admin/tests/run_tests.sh _bin/tests
fi


middle "Generating _configure.h"
case `uname` in
    Linux)
        mkdir _include
        touch _include/_configure.h
        lsb_release -d | grep 'Ubuntu 8.10$' && echo '#define UBUNTU_8_10' >> _include/_configure.h
        ;;
esac


echo
echo 'Good, your configure is finished!'
echo "Now type '$BUILD_CMD' to complete the awesome cycle."

rmdir _build build &> /dev/null

exit 0
Something went wrong with that request. Please try again.