From 8106651e6f1544021bcac17aeff7e0d392321783 Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Mon, 8 Feb 2021 21:04:26 +0100 Subject: [PATCH] bonnmotion: init at 3.0.1 --- .../tools/misc/bonnmotion/default.nix | 50 +++++++++++++ .../tools/misc/bonnmotion/install.patch | 75 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 127 insertions(+) create mode 100644 pkgs/development/tools/misc/bonnmotion/default.nix create mode 100644 pkgs/development/tools/misc/bonnmotion/install.patch diff --git a/pkgs/development/tools/misc/bonnmotion/default.nix b/pkgs/development/tools/misc/bonnmotion/default.nix new file mode 100644 index 000000000000..7ec9f3e1400a --- /dev/null +++ b/pkgs/development/tools/misc/bonnmotion/default.nix @@ -0,0 +1,50 @@ +{ stdenv, lib, fetchzip, substituteAll, bash, jre }: + +stdenv.mkDerivation rec { + pname = "bonnmotion"; + version = "3.0.1"; + + src = fetchzip { + url = "https://sys.cs.uos.de/bonnmotion/src/bonnmotion-${version}.zip"; + sha256 = "16bjgr0hy6an892m5r3x9yq6rqrl11n91f9rambq5ik1cxjqarxw"; + }; + + patches = [ + # The software has a non-standard install bash script which kind of works. + # However, to make it fully functional, the automatically detection of the + # program paths must be substituted with full paths. + (substituteAll { + src = ./install.patch; + inherit bash jre; + }) + ]; + + installPhase = '' + runHook preInstall + + ./install + + mkdir -p $out/bin $out/share/bonnmotion + cp -r ./classes ./lib $out/share/bonnmotion/ + cp ./bin/bm $out/bin/ + + substituteInPlace $out/bin/bm \ + --replace /build/source $out/share/bonnmotion + + runHook postInstall + ''; + + meta = with lib; { + description = "A mobility scenario generation and analysis tool"; + longDescription = '' + BonnMotion is a Java software which creates and analyzes mobility + scenarios and is most commonly used as a tool for the investigation of + mobile ad hoc network characteristics. The scenarios can also be exported + for several network simulators, such as ns-2, ns-3, GloMoSim/QualNet, + COOJA, MiXiM, and ONE. + ''; + homepage = "https://sys.cs.uos.de/bonnmotion/"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ oxzi ]; + }; +} diff --git a/pkgs/development/tools/misc/bonnmotion/install.patch b/pkgs/development/tools/misc/bonnmotion/install.patch new file mode 100644 index 000000000000..86be99b3dd5e --- /dev/null +++ b/pkgs/development/tools/misc/bonnmotion/install.patch @@ -0,0 +1,75 @@ +diff --git a/install b/install +index 95afa2c..70c5fca 100755 +--- a/install ++++ b/install +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!@bash@/bin/bash + + echo "BonnMotion - a mobility scenario generation and analysis tool" + echo "Copyright (C) 2002-2012 University of Bonn" +@@ -19,28 +19,11 @@ echo "along with this program; if not, write to the Free Software" + echo "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" + echo + +-OS=`uname -s | tr A-Z a-z | sed -e s/_.\*//` +- + PACKAGE=edu.bonn.cs.iv.bonnmotion +-JAVAPATH=`which java 2> /dev/null` +-if [ ! "$JAVAPATH" = "" ] +-then +- JAVAPATH=`dirname ${JAVAPATH}` +-fi +-echo -n Please enter your Java binary path \[$JAVAPATH\]:\ +-read KBDENTRY +-if [ ! "$KBDENTRY" = "" ] +-then +- JAVAPATH=$KBDENTRY +-fi ++JAVAPATH="@jre@/bin" + if [ -x "${JAVAPATH}/java" ] + then +- cd `dirname $0` +- BONNMOTION=`pwd` +- +- cd "${JAVAPATH}" +- JAVAPATH=`pwd` +- cd "${BONNMOTION}" ++ BONNMOTION="$(realpath .)" + + CLASSPATH="${BONNMOTION}/classes" + DOCPATH="${BONNMOTION}/javadoc" +@@ -52,14 +35,7 @@ then + then + mkdir "${DOCPATH}" + fi +- if [ $OS = "cygwin" ] +- then +- cd "${CLASSPATH}" +- CLASSPATH=`cmd.exe /c cd` +- cd "${DOCPATH}" +- DOCPATH=`cmd.exe /c cd` +- fi +- ++ + for l in $BONNMOTION/lib/*.jar + do + LIBRARYPATH=$LIBRARYPATH:$l +@@ -69,7 +45,7 @@ then + APPS=`ls` + cd "${BONNMOTION}/bin" + +- echo \#\!/bin/bash > .head ++ echo \#\!@bash@/bin/bash > .head + echo >> .head + echo BONNMOTION=\"$BONNMOTION\" >> .head + echo PACKAGE=\"$PACKAGE\" >> .head +@@ -103,8 +79,6 @@ then + fi + echo "done." + echo +- echo "$ ./bin/bm -h" +- ./bm + else + echo No executable \"$JAVAPATH/java\", aborting. + fi diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11dfb7c970c3..58f2c6db0e08 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1112,6 +1112,8 @@ in bmap-tools = callPackage ../tools/misc/bmap-tools { }; + bonnmotion = callPackage ../development/tools/misc/bonnmotion { }; + bonnie = callPackage ../tools/filesystems/bonnie { }; bonfire = callPackage ../tools/misc/bonfire { };