Skip to content

Instantly share code, notes, and snippets.

@aszlig
Created March 23, 2015 15:12
Show Gist options
  • Save aszlig/c271f294410cc5af0f0a to your computer and use it in GitHub Desktop.
Save aszlig/c271f294410cc5af0f0a to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
libpbutil = stdenv.mkDerivation {
name = "libpbutil";
src = requireFile {
name = "libpbutil.tar.gz";
url = "http://somewhere";
sha256 = "0nc4d6y65h1svd3cylsy8kbc5wwl57whd93pdsi24cxdi2mfrinx";
};
};
in stdenv.mkDerivation rec {
name = "bs1770gain-${version}";
version = "0.4.1";
src = fetchurl {
url = "mirror://sourceforge/bs1770gain/${name}-src.tar.gz";
sha256 = "1iybnn680ac7zyikwnk23bv5j40fy4mb57qdzgji21mxw8vlvxmf";
};
NIX_LDFLAGS = "-lpbutil -lm -ldl";
postPatch = ''
sed -i -e 's/dlopen(path,RTLD_LAZY)/dlopen(s3,RTLD_LAZY)/' \
libffsox-2/ffsox_dynload.c
rm -f libffsox-2/{wasapi,player}.c
cat > CMakeLists.txt <<CMAKE
cmake_minimum_required(VERSION 2.8.11)
project(bs1770gain)
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(avutil libavutil REQUIRED)
pkg_check_modules(sox sox REQUIRED)
include_directories(bs1770gain lib1770-2 libffsox-2)
add_subdirectory(bs1770gain)
add_subdirectory(lib1770-2)
add_subdirectory(libffsox-2)
CMAKE
cat > bs1770gain/CMakeLists.txt <<CMAKE
aux_source_directory(. sources)
file(GLOB headers *.h)
add_executable(bs1770gain \''${sources} \''${headers})
target_link_libraries(bs1770gain lib1770 libffsox avutil)
install(TARGETS bs1770gain DESTINATION \''${CMAKE_INSTALL_BINDIR})
CMAKE
cat > lib1770-2/CMakeLists.txt <<CMAKE
aux_source_directory(. sources)
file(GLOB headers *.h)
add_library(lib1770 \''${sources} \''${headers})
CMAKE
cat > libffsox-2/CMakeLists.txt <<CMAKE
aux_source_directory(. sources)
file(GLOB headers *.h)
add_library(libffsox \''${sources} \''${headers})
target_link_libraries(libffsox lib1770 sox)
CMAKE
'';
buildInputs = [ cmake pkgconfig sox ffmpeg libpbutil ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment