Slightly more progress

This commit is contained in:
Surma
2024-08-07 00:50:25 +01:00
parent 9ce5da7531
commit 11cd02c87b
3 changed files with 36 additions and 46 deletions

View File

@@ -20,6 +20,5 @@ $(filter dec/%,$(OUT_JS)): dec/mozjpeg_dec.cpp
-s ENVIRONMENT=$(ENVIRONMENT) \
-s EXPORT_ES6=1 \
-o $@ \
${MOZJPEG}/lib/rdswitch.o \
${MOZJPEG}/lib/libjpeg.a \
$+ \
-ljpeg \
$+

View File

@@ -19,16 +19,18 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1722640603,
"narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=",
"owner": "NixOS",
"lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "81610abc161d4021b29199aa464d6a1a521e0cc9",
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "nixos",
"ref": "24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {

View File

@@ -1,14 +1,11 @@
{
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/24.05";
};
mozjpeg = {
url = "github:mozilla/mozjpeg/v3.3.1";
flake = false;
# type = "github";
# owner = "mozilla";
# repo = "mozjpeg";
# rev = "v3.3.1";
# hash = "sha256-frpQdkk7bJE5qbV70fdL1FsC4eI0Fm8FWshqBQxCRtk=";
};
};
outputs =
@@ -36,7 +33,7 @@
'';
installPhase = ''
mkdir -p $out
cp
# cp
'';
};
mozjpeg = stdenv.mkDerivation {
@@ -49,47 +46,39 @@
emscripten
pkg-config
];
preConfigure = ''
configurePhase = ''
# $HOME is required for Emscripten to work.
# See: https://nixos.org/manual/nixpkgs/stable/#emscripten
export HOME=$TMPDIR
autoreconf -if
autoreconf -ifv
emconfigure ./configure \
--disable-shared \
--without-turbojpeg \
--without-simd \
--without-arith-enc \
--without-arith-dec \
--with-build-date=squoosh \
--prefix=$out
'';
# configurePhase = ''
# runHook preConfigure
# emconfigure ./configure $configureFlags
# runHook postConfigure
# '';
configureScript = "emconfigure ./configure";
configureFlags = [
"--disable-shared"
"--without-turbojpeg"
"--without-simd"
"--without-arith-enc"
"--without-arith-dec"
"--with-build-date=squoosh"
];
buildFlags = [
"libjpeg.la"
"rdswitch.o"
];
buildPhase = ''
emmake make -j$(nproc) $buildFlags
export HOME=$TMPDIR
emmake make V=1 -j$(nproc) --trace libjpeg.la
'';
installPhase = ''
mkdir -p $out/lib
mkdir -p $out/include
cp .libs/libjpeg.a $out/lib
cp rdswitch.o $out/lib
cp *.h $out/include
'';
checkPhase = ''
true
make install-includeHEADERS install-libLTLIBRARIES
'';
dontFixup = true;
};
};
devShells.${system}.default = pkgs.mkShell {
packages = [
autoconf
automake
libtool
emscripten
pkg-config
];
shellHook = ''
echo "Path to MozJPEG: ${mozjpeg}"
'';