@@ -0,0 +1,57 @@
1+{ stdenv, fetchFromGitHub
2+, alsaLib, espeak, glibc, gpsd
3+, hamlib, perl, python, udev }:
4+
5+with stdenv.lib;
6+
7+stdenv.mkDerivation rec {
8+ pname = "direwolf";
9+ version = "1.5";
10+
11+ src = fetchFromGitHub {
12+ owner = "wb2osz";
13+ repo = "direwolf";
14+ rev = version;
15+ sha256 = "1w55dv9xqgc9mpincsj017838vmvdy972fhis3ddskyfvhhzgcsk";
16+ };
17+
18+ buildInputs = [
19+ espeak gpsd hamlib perl python
20+ ] ++ (optionals stdenv.isLinux [alsaLib udev]);
21+
22+ makeFlags = [ "DESTDIR=$(out)" ];
23+
24+ postPatch = ''
25+ substituteInPlace symbols.c \
26+ --replace /usr/share/direwolf/symbols-new.txt $out/share/direwolf/symbols-new.txt \
27+ --replace /opt/local/share/direwolf/symbols-new.txt $out/share/direwolf/symbols-new.txt
28+ substituteInPlace decode_aprs.c \
29+ --replace /usr/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt \
30+ --replace /opt/local/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt
31+ substituteInPlace dwespeak.sh \
32+ --replace espeak ${espeak}/bin/espeak
33+ '' + (optionalString stdenv.isLinux ''
34+ substituteInPlace Makefile.linux \
35+ --replace /usr/include/pthread.h ${stdenv.glibc.dev}/include/pthread.h \
36+ --replace /usr/include/alsa ${alsaLib.dev}/include/alsa \
37+ --replace /usr/include/gps.h ${gpsd}/include/gps.h \
38+ --replace /usr/include/hamlib ${hamlib}/include/hamlib \
39+ --replace /usr/include/libudev.h ${udev.dev}/include/libudev.h \
40+ --replace /etc/udev $out/etc/udev \
41+ --replace 'Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"' "Exec=$out/bin/direwolf" \
42+ --replace '#Terminal=true' 'Terminal=true' \
43+ --replace 'Path=$(HOME)' '#Path='
44+ '');
45+
46+ preInstall = ''
47+ mkdir -p $out/bin
48+ '';
49+
50+ meta = {
51+ description = "A Soundcard Packet TNC, APRS Digipeater, IGate, APRStt gateway";
52+ homepage = "https://github.com/wb2osz/direwolf/";
53+ license = licenses.gpl2;
54+ platforms = platforms.unix;
55+ maintainers = with maintainers; [ lasandell ];
56+ };
57+}