1{ lib, stdenv, fetchFromGitHub, wxGTK, wxsqlite3, sqlite, Cocoa, setfile }:
2
3stdenv.mkDerivation rec {
4 pname = "wxsqliteplus";
5 version = "0.3.6";
6
7 src = fetchFromGitHub {
8 owner = "guanlisheng";
9 repo = "wxsqliteplus";
10 rev = "v${version}";
11 sha256 = "0mgfq813pli56mar7pdxlhwjf5k10j196rs3jd0nc8b6dkzkzlnf";
12 };
13
14 postPatch = ''
15 sed -i '/WX_CLEAR_ARRAY/s/$/;/' src/{createtable,sqlite3table}.cpp
16 '';
17
18 buildInputs = [ wxGTK wxsqlite3 sqlite ] ++ lib.optional stdenv.isDarwin Cocoa;
19
20 makeFlags = [
21 "LDFLAGS=-L${wxsqlite3}/lib"
22 ] ++ lib.optionals stdenv.isDarwin [
23 "SETFILE=${setfile}/bin/SetFile"
24 ];
25
26 preBuild = ''
27 sed -ie 's|all: $(LIBPREFIX)wxsqlite$(LIBEXT)|all: |g' Makefile
28 sed -ie 's|wxsqliteplus$(EXEEXT): $(WXSQLITEPLUS_OBJECTS) $(LIBPREFIX)wxsqlite$(LIBEXT)|wxsqliteplus$(EXEEXT): $(WXSQLITEPLUS_OBJECTS) |g' Makefile
29 sed -ie 's|-lwxsqlite |-lwxcode_${if stdenv.isDarwin then "osx_cocoau_wxsqlite3-3.2.0" else "gtk3u_wxsqlite3-3.2"} |g' Makefile
30 '';
31
32 installPhase = ''
33 install -D ${lib.optionalString stdenv.isDarwin "wxsqliteplus.app/Contents/MacOS/"}wxsqliteplus $out/bin/wxsqliteplus
34 '' + lib.optionalString stdenv.isDarwin ''
35 mkdir -p $out/Applications
36 mv wxsqliteplus.app $out/Applications/
37 '';
38
39 meta = with lib; {
40 description = "A simple SQLite database browser built with wxWidgets";
41 homepage = "https://github.com/guanlisheng/wxsqliteplus";
42 license = licenses.gpl3Plus;
43 maintainers = [ maintainers.vrthra ];
44 platforms = platforms.unix;
45 };
46}