Created
March 27, 2020 13:43
-
-
Save tomberek/f0b56c0754b55b20e7c881f98ab872b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs>{} }: | |
let | |
src = pkgs.fetchgit { | |
fetchSubmodules = true; | |
url = "https://github.com/notedit/media-server-go-native.git"; | |
deepClone = true; | |
rev = "4b84572c5b39f08e4dfaa44f0fe9e0c0f6b73e63"; | |
sha256 = "sha256-+vrlixx8Z5RlKeafvBER7CClmMPNdEag3EFoeyWgTrs="; | |
}; | |
in | |
with pkgs; | |
let | |
openssl = | |
pkgs.stdenv.mkDerivation { | |
nativeBuildInputs = [ | |
autoconf automake libtool | |
perl | |
]; | |
name = "media-server-go-native-openssl"; | |
inherit src; | |
buildPhase = '' | |
cd ./openssl && export KERNEL_BITS=64 && ./config --prefix=$out --openssldir=$out && make && make install | |
''; | |
}; | |
srtp = | |
pkgs.stdenv.mkDerivation { | |
nativeBuildInputs = [ | |
autoconf automake libtool | |
perl openssl | |
]; | |
name = "media-server-go-native-srtp"; | |
inherit src; | |
buildPhase = '' | |
cd ./libsrtp && ./configure --prefix=$out --enable-openssl --with-openssl-dir=${openssl} && make && make install | |
''; | |
}; | |
mp4v2 = | |
pkgs.stdenv.mkDerivation { | |
nativeBuildInputs = [ | |
autoconf automake libtool | |
perl openssl srtp | |
]; | |
name = "media-server-go-native-mp4v2"; | |
inherit src; | |
buildPhase = '' | |
cd ./mp4v2 && autoreconf -i | |
./configure --prefix=$out | |
make | |
''; | |
}; | |
media-server-go-native = | |
pkgs.stdenv.mkDerivation { | |
nativeBuildInputs = [ | |
autoconf automake libtool | |
perl openssl srtp mp4v2 | |
]; | |
name = "media-server-go-native"; | |
inherit src; | |
buildPhase = '' | |
cp media-Makefile ./media-server/Makefile | |
export ROOT_DIR=$PWD | |
export CXXFLAGS="$CXXFLAGS -msse4.2 -I$src/media-server/ext/crc32c/config/Linux-x86_64" | |
cp config.mk ./media-server/ | |
cd media-server | |
make libmediaserver.a | |
mkdir -p $out/lib | |
cp ./bin/release/libmediaserver.a $out/lib/ | |
''; | |
installPhase = " "; | |
}; | |
in media-server-go-native |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment