nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 208 lines 6.7 kB view raw
1{ pkgs 2, lib 3, stdenv 4, fetchFromGitHub 5, makeWrapper 6, gawk 7, gnum4 8, gnused 9, libxml2 10, libxslt 11, ncurses 12, openssl 13, perl 14, autoconf 15, openjdk11 ? null # javacSupport 16, unixODBC ? null # odbcSupport 17, libGL ? null 18, libGLU ? null 19, wxGTK ? null 20, xorg ? null 21, parallelBuild ? false 22, systemd 23, wxSupport ? true 24, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd # systemd support in epmd 25 # updateScript deps 26, writeScript 27, common-updater-scripts 28, coreutils 29, git 30}: 31{ baseName ? "erlang" 32, version 33, sha256 ? null 34, rev ? "OTP-${version}" 35, src ? fetchFromGitHub { inherit rev sha256; owner = "erlang"; repo = "otp"; } 36, enableHipe ? true 37, enableDebugInfo ? false 38, enableThreads ? true 39, enableSmpSupport ? true 40, enableKernelPoll ? true 41, javacSupport ? false 42, javacPackages ? [ openjdk11 ] 43, odbcSupport ? false 44, odbcPackages ? [ unixODBC ] 45, opensslPackage ? openssl 46, wxPackages ? [ libGL libGLU wxGTK xorg.libX11 ] 47, preUnpack ? "" 48, postUnpack ? "" 49, patches ? [ ] 50, patchPhase ? "" 51, prePatch ? "" 52, postPatch ? "" 53, configureFlags ? [ ] 54, configurePhase ? "" 55, preConfigure ? "" 56, postConfigure ? "" 57, buildPhase ? "" 58, preBuild ? "" 59, postBuild ? "" 60, installPhase ? "" 61, preInstall ? "" 62, postInstall ? "" 63, installTargets ? [ "install" "install-docs" ] 64, checkPhase ? "" 65, preCheck ? "" 66, postCheck ? "" 67, fixupPhase ? "" 68, preFixup ? "" 69, postFixup ? "" 70, meta ? { } 71}: 72 73assert wxSupport -> (if stdenv.isDarwin 74then wxGTK != null 75else libGL != null && libGLU != null && wxGTK != null && xorg != null); 76 77assert odbcSupport -> unixODBC != null; 78assert javacSupport -> openjdk11 != null; 79 80let 81 inherit (lib) optional optionals optionalAttrs optionalString; 82 wxPackages2 = if stdenv.isDarwin then [ wxGTK ] else wxPackages; 83 84in 85stdenv.mkDerivation ({ 86 # name is used instead of pname to 87 # - not have to pass pnames as argument 88 # - have a separate pname for erlang (main module) 89 name = "${baseName}" 90 + optionalString javacSupport "_javac" 91 + optionalString odbcSupport "_odbc" 92 + "-${version}"; 93 94 inherit src version; 95 96 nativeBuildInputs = [ autoconf makeWrapper perl gnum4 libxslt libxml2 ]; 97 98 buildInputs = [ ncurses opensslPackage ] 99 ++ optionals wxSupport wxPackages2 100 ++ optionals odbcSupport odbcPackages 101 ++ optionals javacSupport javacPackages 102 ++ optional systemdSupport systemd 103 ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ AGL Carbon Cocoa WebKit ]); 104 105 debugInfo = enableDebugInfo; 106 107 # On some machines, parallel build reliably crashes on `GEN asn1ct_eval_ext.erl` step 108 enableParallelBuilding = parallelBuild; 109 110 postPatch = '' 111 patchShebangs make 112 113 ${postPatch} 114 ''; 115 116 preConfigure = '' 117 ./otp_build autoconf 118 ''; 119 120 configureFlags = [ "--with-ssl=${lib.getOutput "out" opensslPackage}" ] 121 ++ [ "--with-ssl-incl=${lib.getDev opensslPackage}" ] # This flag was introduced in R24 122 ++ optional enableThreads "--enable-threads" 123 ++ optional enableSmpSupport "--enable-smp-support" 124 ++ optional enableKernelPoll "--enable-kernel-poll" 125 ++ optional enableHipe "--enable-hipe" 126 ++ optional javacSupport "--with-javac" 127 ++ optional odbcSupport "--with-odbc=${unixODBC}" 128 ++ optional wxSupport "--enable-wx" 129 ++ optional systemdSupport "--enable-systemd" 130 ++ optional stdenv.isDarwin "--enable-darwin-64bit" 131 # make[3]: *** [yecc.beam] Segmentation fault: 11 132 ++ optional (stdenv.isDarwin && stdenv.isx86_64) "--disable-jit" 133 ++ configureFlags; 134 135 # install-docs will generate and install manpages and html docs 136 # (PDFs are generated only when fop is available). 137 138 postInstall = '' 139 ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call 140 141 ${postInstall} 142 ''; 143 144 # Some erlang bin/ scripts run sed and awk 145 postFixup = '' 146 wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/" 147 wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${lib.makeBinPath [ gnused gawk ]}" 148 ''; 149 150 passthru = { 151 updateScript = 152 let major = builtins.head (builtins.splitVersion version); 153 in 154 writeScript "update.sh" '' 155 #!${stdenv.shell} 156 set -ox errexit 157 PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]} 158 latest=$(list-git-tags --url=https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1) 159 if [ "$latest" != "${version}" ]; then 160 nixpkgs="$(git rev-parse --show-toplevel)" 161 nix_file="$nixpkgs/pkgs/development/interpreters/erlang/${major}.nix" 162 update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file" 163 else 164 echo "${baseName}R${major} is already up-to-date" 165 fi 166 ''; 167 }; 168 169 meta = with lib; ({ 170 homepage = "https://www.erlang.org/"; 171 downloadPage = "https://www.erlang.org/download.html"; 172 description = "Programming language used for massively scalable soft real-time systems"; 173 174 longDescription = '' 175 Erlang is a programming language used to build massively scalable 176 soft real-time systems with requirements on high availability. 177 Some of its uses are in telecoms, banking, e-commerce, computer 178 telephony and instant messaging. Erlang's runtime system has 179 built-in support for concurrency, distribution and fault 180 tolerance. 181 ''; 182 183 platforms = platforms.unix; 184 maintainers = teams.beam.members; 185 license = licenses.asl20; 186 } // meta); 187} 188// optionalAttrs (preUnpack != "") { inherit preUnpack; } 189// optionalAttrs (postUnpack != "") { inherit postUnpack; } 190// optionalAttrs (patches != [ ]) { inherit patches; } 191// optionalAttrs (prePatch != "") { inherit prePatch; } 192// optionalAttrs (patchPhase != "") { inherit patchPhase; } 193// optionalAttrs (configurePhase != "") { inherit configurePhase; } 194// optionalAttrs (preConfigure != "") { inherit preConfigure; } 195// optionalAttrs (postConfigure != "") { inherit postConfigure; } 196// optionalAttrs (buildPhase != "") { inherit buildPhase; } 197// optionalAttrs (preBuild != "") { inherit preBuild; } 198// optionalAttrs (postBuild != "") { inherit postBuild; } 199// optionalAttrs (checkPhase != "") { inherit checkPhase; } 200// optionalAttrs (preCheck != "") { inherit preCheck; } 201// optionalAttrs (postCheck != "") { inherit postCheck; } 202// optionalAttrs (installPhase != "") { inherit installPhase; } 203// optionalAttrs (installTargets != [ ]) { inherit installTargets; } 204// optionalAttrs (preInstall != "") { inherit preInstall; } 205// optionalAttrs (fixupPhase != "") { inherit fixupPhase; } 206// optionalAttrs (preFixup != "") { inherit preFixup; } 207// optionalAttrs (postFixup != "") { inherit postFixup; } 208)