It finally compiles

This commit is contained in:
Surma
2024-08-07 01:07:42 +01:00
parent 11cd02c87b
commit ec2a05ec33
8 changed files with 8 additions and 74 deletions

View File

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

View File

@@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "jconfig.h"
#include "jpeglib.h"
extern "C" {

View File

@@ -1,37 +0,0 @@
export const enum MozJpegColorSpace {
GRAYSCALE = 1,
RGB,
YCbCr,
}
export interface EncodeOptions {
quality: number;
baseline: boolean;
arithmetic: boolean;
progressive: boolean;
optimize_coding: boolean;
smoothing: number;
color_space: MozJpegColorSpace;
quant_table: number;
trellis_multipass: boolean;
trellis_opt_zero: boolean;
trellis_opt_table: boolean;
trellis_loops: number;
auto_subsample: boolean;
chroma_subsample: number;
separate_chroma_quality: boolean;
chroma_quality: number;
}
export interface MozJPEGModule extends EmscriptenWasm.Module {
encode(
data: BufferSource,
width: number,
height: number,
options: EncodeOptions,
): Uint8Array;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<MozJPEGModule>;
export default moduleFactory;

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@
'';
installPhase = ''
mkdir -p $out
# cp
cp enc/*.{wasm,js} $out
'';
};
mozjpeg = stdenv.mkDerivation {
@@ -62,10 +62,12 @@
'';
buildPhase = ''
export HOME=$TMPDIR
emmake make V=1 -j$(nproc) --trace libjpeg.la
emmake make V=1 -j$(nproc) --trace
'';
installPhase = ''
make install-includeHEADERS install-libLTLIBRARIES
make install
cp *.h $out/include
cp rdswitch.o $out/lib
'';
dontFixup = true;