Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nix flake for macOS #2595

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 37 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 49 additions & 50 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@
{
description = "GPAC Multimedia Open Source Project";
inputs = {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs }@inputs:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
buildInputs = with pkgs; [
zlib
git
freetype
libjpeg_turbo
libpng
libmad
faad2
libogg
libvorbis
libtheora
a52dec
ffmpeg
xorg.libX11
xorg.libXv
xorg.xorgproto
mesa
xvidcore
openssl
alsa-lib
jack2
pulseaudio
SDL2
mesa-demos
];
nativeBuildInputs = with pkgs; [ pkg-config ];
in
with pkgs; {
devShells.x86_64-linux.default = mkShell {
inherit buildInputs nativeBuildInputs;
};
packages.x86_64-linux.default = with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "gpac";
src = self;
inherit buildInputs nativeBuildInputs;
configurePhase = ''
runHook preConfigure
./configure --prefix=$out
runHook postConfigure
'';
buildPhase = "make -j $NIX_BUILD_CORES";
installPhase = "make install";
};

};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
buildInputs = with pkgs; [
zlib
freetype
libjpeg_turbo
libpng
libmad
faad2
libaom
libogg
libvorbis
libtheora
a52dec
ffmpeg
xvidcore
openssl
SDL2
] ++ (lib.optionals stdenv.isLinux [
xorg.libX11
xorg.libXv
xorg.xorgproto
mesa
alsa-lib
jack2
pulseaudio
mesa-demos
]) ++ (lib.optionals stdenv.isDarwin [
darwin.apple_sdk_11_0.frameworks.Carbon
]);
nativeBuildInputs = with pkgs; [ pkg-config git ];
in
with pkgs; {
devShells.default = mkShell {
inherit buildInputs nativeBuildInputs;
};
packages.default = stdenv.mkDerivation {
name = "gpac";
src = self;
enableParallelBuilding = true;
inherit buildInputs nativeBuildInputs;
};
});
}
6 changes: 6 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,22 @@ crypto/g_crypt_openssl.o: crypto/g_crypt_openssl.c

ifeq ($(CONFIG_DARWIN),yes)

ifeq ($(STATIC_MODULES),yes)
$(LIBTOOL) -s -o ../bin/gcc/libgpac_static.a $(OBJS)
$(RANLIB) ../bin/gcc/libgpac_static.a
endif

ifneq ($(STATIC_BUILD),yes)
$(CC) $(SHFLAGS) $(LD_SONAME) -o $@ $(OBJS) $(ALL_LIBS) $(LDFLAGS)
endif

else

ifeq ($(STATIC_MODULES),yes)
$(AR) cr ../bin/gcc/libgpac_static.a $(OBJS)
$(RANLIB) ../bin/gcc/libgpac_static.a
endif

ifneq ($(STATIC_BUILD),yes)
$(CC) $(SHFLAGS) $(LD_SONAME) -o $@ $(OBJS) $(ALL_LIBS) $(LDFLAGS)
mv $@ $@.$(VERSION_SONAME)
Expand Down