summary refs log tree commit diff
path: root/pkgs/development/tools/misc/bonnmotion
diff options
context:
space:
mode:
authorAlvar Penning <post@0x21.biz>2021-02-08 21:04:26 +0100
committerAlvar Penning <post@0x21.biz>2021-02-08 21:27:10 +0100
commit8106651e6f1544021bcac17aeff7e0d392321783 (patch)
treef6576505019b57cedbe4da7b6aed30e09145eb51 /pkgs/development/tools/misc/bonnmotion
parent93498b15264bb796d4ff3a08971b96847cdd9391 (diff)
downloadnixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar.gz
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar.bz2
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar.lz
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar.xz
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.tar.zst
nixpkgs-8106651e6f1544021bcac17aeff7e0d392321783.zip
bonnmotion: init at 3.0.1
Diffstat (limited to 'pkgs/development/tools/misc/bonnmotion')
-rw-r--r--pkgs/development/tools/misc/bonnmotion/default.nix50
-rw-r--r--pkgs/development/tools/misc/bonnmotion/install.patch75
2 files changed, 125 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/bonnmotion/default.nix b/pkgs/development/tools/misc/bonnmotion/default.nix
new file mode 100644
index 00000000000..7ec9f3e1400
--- /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 00000000000..86be99b3dd5
--- /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