forked from external-repos/squoosh
Work on all systems
This commit is contained in:
38
codecs/mozjpeg/flake.lock
generated
38
codecs/mozjpeg/flake.lock
generated
@@ -1,6 +1,24 @@
|
||||
{
|
||||
"nodes": {
|
||||
"mozjpeg": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mozjpeg-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1499684294,
|
||||
@@ -35,9 +53,25 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"mozjpeg": "mozjpeg",
|
||||
"flake-utils": "flake-utils",
|
||||
"mozjpeg-src": "mozjpeg-src",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs = {
|
||||
url = "github:nixos/nixpkgs/24.05";
|
||||
};
|
||||
mozjpeg = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/24.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
mozjpeg-src = {
|
||||
url = "github:mozilla/mozjpeg/v3.3.1";
|
||||
flake = false;
|
||||
};
|
||||
@@ -12,80 +11,83 @@
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
mozjpeg,
|
||||
flake-utils,
|
||||
mozjpeg-src,
|
||||
}:
|
||||
let
|
||||
system = "aarch64-darwin";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
with pkgs;
|
||||
rec {
|
||||
packages.${system} = {
|
||||
default = stdenv.mkDerivation {
|
||||
name = "mozjpeg-squoosh";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
emscripten
|
||||
packages.${system}.mozjpeg
|
||||
];
|
||||
MOZJPEG = packages.${system}.mozjpeg;
|
||||
dontConfigure = true;
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
emmake make -j$(nproc)
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp enc/*.{wasm,js} $out
|
||||
'';
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
with pkgs;
|
||||
{
|
||||
packages = rec {
|
||||
default = stdenv.mkDerivation {
|
||||
name = "mozjpeg-squoosh";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
emscripten
|
||||
mozjpeg
|
||||
];
|
||||
MOZJPEG = mozjpeg;
|
||||
dontConfigure = true;
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
emmake make -j$(nproc)
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp enc/*.{wasm,js} $out
|
||||
'';
|
||||
};
|
||||
mozjpeg = stdenv.mkDerivation {
|
||||
name = "mozjpeg";
|
||||
src = mozjpeg-src;
|
||||
nativeBuildInputs = [
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
emscripten
|
||||
pkg-config
|
||||
];
|
||||
configurePhase = ''
|
||||
# $HOME is required for Emscripten to work.
|
||||
# See: https://nixos.org/manual/nixpkgs/stable/#emscripten
|
||||
export HOME=$TMPDIR
|
||||
autoreconf -ifv
|
||||
emconfigure ./configure \
|
||||
--disable-shared \
|
||||
--without-turbojpeg \
|
||||
--without-simd \
|
||||
--without-arith-enc \
|
||||
--without-arith-dec \
|
||||
--with-build-date=squoosh \
|
||||
--prefix=$out
|
||||
'';
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
emmake make V=1 -j$(nproc) --trace
|
||||
'';
|
||||
installPhase = ''
|
||||
make install
|
||||
cp *.h $out/include
|
||||
cp rdswitch.o $out/lib
|
||||
'';
|
||||
dontFixup = true;
|
||||
};
|
||||
};
|
||||
mozjpeg = stdenv.mkDerivation {
|
||||
name = "mozjpeg";
|
||||
src = mozjpeg;
|
||||
nativeBuildInputs = [
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
emscripten
|
||||
pkg-config
|
||||
];
|
||||
configurePhase = ''
|
||||
# $HOME is required for Emscripten to work.
|
||||
# See: https://nixos.org/manual/nixpkgs/stable/#emscripten
|
||||
export HOME=$TMPDIR
|
||||
autoreconf -ifv
|
||||
emconfigure ./configure \
|
||||
--disable-shared \
|
||||
--without-turbojpeg \
|
||||
--without-simd \
|
||||
--without-arith-enc \
|
||||
--without-arith-dec \
|
||||
--with-build-date=squoosh \
|
||||
--prefix=$out
|
||||
shellHook = ''
|
||||
echo "Path to MozJPEG: ${mozjpeg-src}"
|
||||
'';
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
emmake make V=1 -j$(nproc) --trace
|
||||
'';
|
||||
installPhase = ''
|
||||
make install
|
||||
cp *.h $out/include
|
||||
cp rdswitch.o $out/lib
|
||||
'';
|
||||
dontFixup = true;
|
||||
};
|
||||
};
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
emscripten
|
||||
pkg-config
|
||||
];
|
||||
shellHook = ''
|
||||
echo "Path to MozJPEG: ${mozjpeg}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user