From 125600079dbff3a40bf66b536d2bf7c9aa40d28f Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 13 Sep 2009 18:31:33 +0000 Subject: [PATCH] Updating XMoto (and adding some functionality to upstream tracking system) svn path=/nixpkgs/trunk/; revision=17100 --- .../upstream-updater/snippets.sh | 5 ++++ .../upstream-updater/update-upstream-data.sh | 3 ++- pkgs/games/xmoto/default.nix | 23 +++++++++---------- pkgs/games/xmoto/src-for-default.nix | 9 ++++++++ pkgs/games/xmoto/src-info-for-default.nix | 7 ++++++ 5 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 pkgs/games/xmoto/src-for-default.nix create mode 100644 pkgs/games/xmoto/src-info-for-default.nix diff --git a/pkgs/build-support/upstream-updater/snippets.sh b/pkgs/build-support/upstream-updater/snippets.sh index 27a7c14b1ec0..91be8e178491 100644 --- a/pkgs/build-support/upstream-updater/snippets.sh +++ b/pkgs/build-support/upstream-updater/snippets.sh @@ -4,3 +4,8 @@ #http://downloads.sourceforge.net/webdruid/files/webdruid/0.6.0-alpha5/webdruid-0.6.0-alpha5.tar.gz skipRedirectSF='s@^http://sourceforge.net/projects/@http://downloads.sourceforge.net/@; s@/download$@@' extractReleaseSF='s@.*/([^/]+)/[^/]+@\1@' + +replaceAllVersionOccurences() { + echo s/"$version"/\${version}/g +} +dashDelimitedVersion='s/.*-([0-9.]+)-.*/\1/' diff --git a/pkgs/build-support/upstream-updater/update-upstream-data.sh b/pkgs/build-support/upstream-updater/update-upstream-data.sh index f4861aa11d1e..dfdb74e363fa 100755 --- a/pkgs/build-support/upstream-updater/update-upstream-data.sh +++ b/pkgs/build-support/upstream-updater/update-upstream-data.sh @@ -37,7 +37,7 @@ prefetchClause="" eval "egrep \"$(getAttr sourceRegexp '.*[.]tar[.].*')\"" | eval "$(getAttr choiceCommand 'head -1')")" - if ! egrep ':' freshUrl ; then + if ! egrep ':' <<< "$freshUrl" ; then freshUrl="$(dirname "$(getAttr downloadPage).")/$freshUrl" fi @@ -54,6 +54,7 @@ prefetchClause="" eval "sed -r -e \"$(getAttr versionReferenceCreator \ 's/-([0-9.]+)[.]/-${version}./')\"" | eval "sed -r -e \"$(getAttr mirrorSedScript)\"")" + url="$mirrorUrl" name="$baseName-$version" diff --git a/pkgs/games/xmoto/default.nix b/pkgs/games/xmoto/default.nix index b6222c097d02..5fa44eacfba2 100644 --- a/pkgs/games/xmoto/default.nix +++ b/pkgs/games/xmoto/default.nix @@ -1,29 +1,28 @@ -args : +a : let - lib = args.lib; - fetchurl = args.fetchurl; - - version = lib.attrByPath ["version"] "0.5.1" args; - buildInputs = with args; [ + s = import ./src-for-default.nix; + buildInputs = with a; [ chipmunk sqlite curl zlib bzip2 libjpeg libpng freeglut mesa SDL SDL_mixer SDL_image SDL_net SDL_ttf lua5 ode ]; in rec { - src = fetchurl { - url = "http://download.tuxfamily.org/xmoto/xmoto/${version}/xmoto-${version}-src.tar.gz"; - sha256 = "1clfw4kr34gda9ml427n8mdkhj0hhlldibiq1ay88glqqwvgj2j2"; - }; + src = a.fetchUrlFromSrcInfo s; + inherit (s) name; inherit buildInputs; configureFlags = []; - /* doConfigure should be specified separately */ + /* doConfigure should be removed if not needed */ phaseNames = ["doConfigure" "doMakeInstall"]; - name = "xmoto-" + version; meta = { description = "X-Moto - obstacled race game"; + maintainers = [ + a.lib.maintainers.raskin + ]; + platforms = with a.lib.platforms; + linux ++ freebsd; }; } diff --git a/pkgs/games/xmoto/src-for-default.nix b/pkgs/games/xmoto/src-for-default.nix new file mode 100644 index 000000000000..bc024263c226 --- /dev/null +++ b/pkgs/games/xmoto/src-for-default.nix @@ -0,0 +1,9 @@ +rec { + version="0.5.2"; + name="xmoto-0.5.2"; + hash="13q5b0a1ha5am3p2b7a399ca7vnw4fs82y96aw0n96s3xmw17jd8"; + url="http://download.tuxfamily.org/xmoto/xmoto/${version}/xmoto-${version}-src.tar.gz"; + advertisedUrl="http://download.tuxfamily.org/xmoto/xmoto/0.5.2/xmoto-0.5.2-src.tar.gz"; + + +} diff --git a/pkgs/games/xmoto/src-info-for-default.nix b/pkgs/games/xmoto/src-info-for-default.nix new file mode 100644 index 000000000000..8d5d3f49822c --- /dev/null +++ b/pkgs/games/xmoto/src-info-for-default.nix @@ -0,0 +1,7 @@ +{ + downloadPage = "http://xmoto.tuxfamily.org/"; + baseName = "xmoto"; + sourceRegexp = "xmoto-.*-src[.]tar[.].*"; + versionExtractorSedScript = ''$dashDelimitedVersion''; + versionReferenceCreator=''$(replaceAllVersionOccurences)''; +}