1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, darwin
6, makeWrapper
7, shared-mime-info
8, boost
9, wxGTK32
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "wxformbuilder";
14 version = "4.0.0";
15
16 src = fetchFromGitHub {
17 owner = "wxFormBuilder";
18 repo = "wxFormBuilder";
19 rev = "v${finalAttrs.version}";
20 fetchSubmodules = true;
21 leaveDotGit = true;
22 postFetch = ''
23 substituteInPlace $out/.git-properties \
24 --replace "\$Format:%h\$" "$(git -C $out rev-parse --short HEAD)" \
25 --replace "\$Format:%(describe)\$" "$(git -C $out rev-parse --short HEAD)"
26 rm -rf $out/.git
27 '';
28 hash = "sha256-Lqta+u9WVwUREsR7aH+2DJn0oM5QwlwRSBImuwNkmS4=";
29 };
30
31 postPatch = ''
32 substituteInPlace third_party/tinyxml2/cmake/tinyxml2.pc.in \
33 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
34 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
35 sed -i '/fixup_bundle/d' cmake/macros.cmake
36 '';
37
38 nativeBuildInputs = [
39 cmake
40 ] ++ lib.optionals stdenv.isDarwin [
41 darwin.sigtool
42 makeWrapper
43 ] ++ lib.optionals stdenv.isLinux [
44 shared-mime-info
45 ];
46
47 buildInputs = [
48 boost
49 wxGTK32
50 ] ++ lib.optionals stdenv.isDarwin [
51 darwin.apple_sdk.frameworks.Cocoa
52 ];
53
54 postInstall = lib.optionalString stdenv.isDarwin ''
55 mkdir -p $out/{Applications,bin}
56 mv $out/wxFormBuilder.app $out/Applications
57 makeWrapper $out/Applications/wxFormBuilder.app/Contents/MacOS/wxFormBuilder $out/bin/wxformbuilder
58 '';
59
60 meta = with lib; {
61 description = "RAD tool for wxWidgets GUI design";
62 homepage = "https://github.com/wxFormBuilder/wxFormBuilder";
63 license = licenses.gpl2Only;
64 mainProgram = "wxformbuilder";
65 maintainers = with maintainers; [ matthuszagh wegank ];
66 platforms = platforms.unix;
67 };
68})