badvpn: refactor

This commit is contained in:
Felix Buehler 2021-12-21 11:44:45 +01:00
parent d2a93c1fc1
commit a90c60933d
2 changed files with 16 additions and 29 deletions

View File

@ -1,39 +1,29 @@
{lib, stdenv, fetchurl, cmake, openssl, nss, pkg-config, nspr, bash, debug ? false}:
let
s = # Generated upstream information
rec {
baseName="badvpn";
version="1.999.130";
name="${baseName}-${version}";
hash="02b1fra43l75mljkhrq45vcrrqv0znicjn15g7nbqx3jppzbpm5z";
url="https://github.com/ambrop72/badvpn/archive/1.999.130.tar.gz";
sha256="02b1fra43l75mljkhrq45vcrrqv0znicjn15g7nbqx3jppzbpm5z";
{ lib, stdenv, fetchurl, cmake, openssl, nss, pkg-config, nspr, bash, debug ? false }:
stdenv.mkDerivation rec {
pname = "badvpn";
version = "1.999.130";
src = fetchurl {
url = "https://github.com/ambrop72/badvpn/archive/${version}.tar.gz";
sha256 = "sha256-v9S7/r1ydLzseSVYyaL9YOOc2S4EZzglreXQQVR2YQk=";
};
compileFlags = "-O3 ${lib.optionalString (!debug) "-DNDEBUG"}";
in
stdenv.mkDerivation {
inherit (s) name version;
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
openssl nss nspr
openssl
nss
nspr
];
src = fetchurl {
inherit (s) url sha256;
};
preConfigure = ''
find . -name '*.sh' -exec sed -e 's@#!/bin/sh@${stdenv.shell}@' -i '{}' ';'
find . -name '*.sh' -exec sed -e 's@#!/bin/bash@${bash}/bin/bash@' -i '{}' ';'
cmakeFlagsArray=("-DCMAKE_BUILD_TYPE=" "-DCMAKE_C_FLAGS=${compileFlags}");
cmakeFlagsArray=("-DCMAKE_BUILD_TYPE=" "-DCMAKE_C_FLAGS=-O3 ${lib.optionalString (!debug) "-DNDEBUG"}");
'';
meta = {
inherit (s) version;
meta = with lib; {
description = "A set of network-related (mostly VPN-related) tools";
license = lib.licenses.bsd3 ;
maintainers = [lib.maintainers.raskin];
platforms = lib.platforms.linux;
license = licenses.bsd3;
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux;
};
}

View File

@ -1,3 +0,0 @@
url https://github.com/ambrop72/badvpn/releases
version_link '[0-9][.]tar[.][a-z0-9]+$'
version '.*/([0-9.]+)[.]tar[.].*' '\1'