Skip to content

Commit

Permalink
fix mac support
Browse files Browse the repository at this point in the history
  • Loading branch information
RodolpheFouquet committed Apr 28, 2024
1 parent a5ddd64 commit b4d88ce
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
4 changes: 4 additions & 0 deletions configure
Expand Up @@ -92,6 +92,7 @@ libgpac_extralibs=""
static_build="no"
static_bin="no"
static_modules="no"
libgpac_static="yes"
lm_lib=""
has_directx="no"
win32="no"
Expand Down Expand Up @@ -674,6 +675,8 @@ for opt do
echo "$opt deprecated, use --static-build instead"
static_build="yes";
;;
--disable-static) libgpac_static="no";
;;
--enable-fixed-point) use_fixed_point="yes"
;;
--strip) INSTFLAGS="-s $INSTFLAGS"
Expand Down Expand Up @@ -3001,6 +3004,7 @@ echo "DEBUGBUILD=$debuginfo" >> config.mak
echo "GPROFBUILD=$gprof_build" >> config.mak
echo "STATIC_BINARY=$static_bin" >> config.mak
echo "STATIC_BUILD=$static_build" >> config.mak
echo "LIBGPAC_STATIC=$libgpac_static" >> config.mak

echo "CONFIG_IPV6=$has_ipv6" >> config.mak
if test "$has_ipv6" = "yes" ; then
Expand Down
27 changes: 17 additions & 10 deletions flake.nix
Expand Up @@ -8,7 +8,6 @@
flake-utils.lib.eachDefaultSystem (system:
let
name = "gpac";
src = self;
pkgs = nixpkgs.legacyPackages.${system};
buildInputs = with pkgs; [
zlib
Expand All @@ -24,37 +23,45 @@
ffmpeg
xvidcore
openssl
alsa-lib
SDL2
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
darwin.CarbonHeaders
darwin.apple_sdk.frameworks.Carbon
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
mesa
mesa-demos
alsa-lib
pulseaudio
jack2
xorg.libX11
xorg.libXv
xorg.xorgproto
];
nativeBuildInputs = with pkgs; [ git pkg-config ];
nativeBuildInputs = with pkgs; [
git
pkg-config
];
in
with pkgs;
{
packages.default = stdenv.mkDerivation {
inherit buildInputs name src nativeBuildInputs;
inherit buildInputs name nativeBuildInputs;
src = self;
meta = with nixpkgs.lib; {
homepage = "https://gpac.io";
description =
"For Video Streaming and Next-Gen Multimedia Transcoding, Packaging and Delivery.";
platforms = platforms.darwin ++ platforms.linux;
mainProgram = "gpac";
#TODO support Nix uses glibtool instead of Apple libtool, we do not support it
darwinConfigureFlags = [ "--disable-static" ];
};
};

devShells.default = mkShell {
inherit buildInputs nativeBuildInputs;
};

meta = with nixpkgs.lib; {
homepage = "https://gpac.io";
description =
"For Video Streaming and Next-Gen Multimedia Transcoding, Packaging and Delivery.";
platforms = platforms.all;
};
}
);

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile
Expand Up @@ -374,16 +374,20 @@ crypto/g_crypt_openssl.o: crypto/g_crypt_openssl.c

ifeq ($(CONFIG_DARWIN),yes)

ifeq ($(LIBGPAC_STATIC),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 ($(LIBGPAC_STATIC),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

0 comments on commit b4d88ce

Please sign in to comment.