summary refs log tree commit diff
diff options
context:
space:
mode:
authorTaeer Bar-Yam <taeer@bar-yam.me>2021-04-27 13:59:41 -0400
committerTaeer Bar-Yam <taeer@bar-yam.me>2021-04-29 20:47:57 -0400
commite1b933ccdc67ce654d9cab658bb2970677ea20bb (patch)
tree9a10a8112c836cc32dcb255757e7c4fac7b4fd1e
parent61a31ad3d6c58cf7cc7c57fb998835c019e458d2 (diff)
downloadnixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar.gz
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar.bz2
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar.lz
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar.xz
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.tar.zst
nixpkgs-e1b933ccdc67ce654d9cab658bb2970677ea20bb.zip
opusfile: fix windows compilation
-rw-r--r--pkgs/applications/audio/opusfile/default.nix14
-rw-r--r--pkgs/applications/audio/opusfile/disable-cert-store.patch35
-rw-r--r--pkgs/development/libraries/libopus/default.nix2
3 files changed, 45 insertions, 6 deletions
diff --git a/pkgs/applications/audio/opusfile/default.nix b/pkgs/applications/audio/opusfile/default.nix
index e4f7e6ca6b4..a6683904cb1 100644
--- a/pkgs/applications/audio/opusfile/default.nix
+++ b/pkgs/applications/audio/opusfile/default.nix
@@ -1,23 +1,27 @@
 { lib, stdenv, fetchurl, pkg-config, openssl, libogg, libopus }:
 
 stdenv.mkDerivation rec {
-  name = "opusfile-0.12";
+  pname = "opusfile";
+  version = "0.12";
   src = fetchurl {
-    url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
+    url = "http://downloads.xiph.org/releases/opus/opusfile-${version}.tar.gz";
     sha256 = "02smwc5ah8nb3a67mnkjzqmrzk43j356hgj2a97s9midq40qd38i";
   };
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ openssl libogg ];
   propagatedBuildInputs = [ libopus ];
-  patches = [ ./include-multistream.patch ];
+  patches = [ ./include-multistream.patch ]
+    # fixes problem with openssl 1.1 dependency
+    # see https://github.com/xiph/opusfile/issues/13
+    ++ lib.optionals stdenv.hostPlatform.isWindows [ ./disable-cert-store.patch ];
   configureFlags = [ "--disable-examples" ];
 
   meta = with lib; {
     description = "High-level API for decoding and seeking in .opus files";
     homepage = "https://www.opus-codec.org/";
     license = licenses.bsd3;
-    platforms = platforms.linux ++ platforms.darwin;
-    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+    maintainers = with maintainers; [ taeer ];
   };
 }
diff --git a/pkgs/applications/audio/opusfile/disable-cert-store.patch b/pkgs/applications/audio/opusfile/disable-cert-store.patch
new file mode 100644
index 00000000000..e0a7dd4fe3d
--- /dev/null
+++ b/pkgs/applications/audio/opusfile/disable-cert-store.patch
@@ -0,0 +1,35 @@
+diff --git a/src/http.c b/src/http.c
+index bd08562..3a3592c 100644
+--- a/src/http.c
++++ b/src/http.c
+@@ -327,10 +327,12 @@ static int op_poll_win32(struct pollfd *_fds,nfds_t _nfds,int _timeout){
+ typedef ptrdiff_t ssize_t;
+ #  endif
+ 
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ /*Load certificates from the built-in certificate store.*/
+ int SSL_CTX_set_default_verify_paths_win32(SSL_CTX *_ssl_ctx);
+ #  define SSL_CTX_set_default_verify_paths \
+  SSL_CTX_set_default_verify_paths_win32
++#endif
+ 
+ # else
+ /*Normal Berkeley sockets.*/
+diff --git a/src/wincerts.c b/src/wincerts.c
+index 409a4e0..c355952 100644
+--- a/src/wincerts.c
++++ b/src/wincerts.c
+@@ -33,6 +33,8 @@
+ # include <openssl/err.h>
+ # include <openssl/x509.h>
+ 
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++
+ static int op_capi_new(X509_LOOKUP *_lu){
+   HCERTSTORE h_store;
+   h_store=CertOpenStore(CERT_STORE_PROV_SYSTEM_A,0,0,
+@@ -171,3 +173,4 @@ int SSL_CTX_set_default_verify_paths_win32(SSL_CTX *_ssl_ctx){
+ }
+ 
+ #endif
++#endif
diff --git a/pkgs/development/libraries/libopus/default.nix b/pkgs/development/libraries/libopus/default.nix
index 51179ecb9a0..8172bd38e10 100644
--- a/pkgs/development/libraries/libopus/default.nix
+++ b/pkgs/development/libraries/libopus/default.nix
@@ -24,6 +24,6 @@ stdenv.mkDerivation {
     description = "Open, royalty-free, highly versatile audio codec";
     license = lib.licenses.bsd3;
     homepage = "https://www.opus-codec.org/";
-    platforms = platforms.unix;
+    platforms = platforms.all;
   };
 }