Reproducible Builds: Passing --date to jar in
Hello!
I'm trying to reproduce a .jar that was built with CMake, the jar content seems to match but the .jar itself contains timestamps of the buildtime.
│ ├── usr/share/java/turbojpeg.jar
│ │ ├── zipinfo {}
│ │ │ @@ -1,18 +1,18 @@
│ │ │ Zip file size: 56496 bytes, number of entries: 16
│ │ │ --rw---- 1.0 fat 0 bx stor 24-Jan-25 22:04 META-INF/
│ │ │ --rw---- 2.0 fat 74 bl defN 24-Jan-25 22:04 META-INF/MANIFEST.MF
│ │ │ --rw---- 2.0 fat 736 bl defN 24-Jan-25 22:04 TJBench$DummyDCTFilter.class
│ │ │ --rw---- 2.0 fat 37319 bl defN 24-Jan-25 22:04 TJBench.class
│ │ │ --rw---- 2.0 fat 11777 bl defN 24-Jan-25 22:04 TJExample.class
│ │ │ --rw---- 2.0 fat 24985 bl defN 24-Jan-25 22:04 TJUnitTest.class
│ │ │ --rw---- 2.0 fat 4555 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJ.class
│ │ │ --rw---- 2.0 fat 8937 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJCompressor.class
│ │ │ --rw---- 2.0 fat 336 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJCustomFilter.class
│ │ │ --rw---- 2.0 fat 12512 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJDecompressor.class
│ │ │ --rw---- 2.0 fat 904 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJException.class
│ │ │ --rw---- 2.0 fat 1124 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJLoader.class
│ │ │ --rw---- 2.0 fat 925 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJScalingFactor.class
│ │ │ --rw---- 2.0 fat 1429 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJTransform.class
│ │ │ --rw---- 2.0 fat 2469 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/TJTransformer.class
│ │ │ --rw---- 2.0 fat 4552 bl defN 24-Jan-25 22:04 org/libjpegturbo/turbojpeg/YUVImage.class
│ │ │ +-rw---- 1.0 fat 0 bx stor 24-Mar-02 04:40 META-INF/
│ │ │ +-rw---- 2.0 fat 74 bl defN 24-Mar-02 04:40 META-INF/MANIFEST.MF
│ │ │ +-rw---- 2.0 fat 736 bl defN 24-Mar-02 04:40 TJBench$DummyDCTFilter.class
│ │ │ +-rw---- 2.0 fat 37319 bl defN 24-Mar-02 04:40 TJBench.class
│ │ │ +-rw---- 2.0 fat 11777 bl defN 24-Mar-02 04:40 TJExample.class
│ │ │ +-rw---- 2.0 fat 24985 bl defN 24-Mar-02 04:40 TJUnitTest.class
│ │ │ +-rw---- 2.0 fat 4555 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJ.class
│ │ │ +-rw---- 2.0 fat 8937 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJCompressor.class
│ │ │ +-rw---- 2.0 fat 336 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJCustomFilter.class
│ │ │ +-rw---- 2.0 fat 12512 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJDecompressor.class
│ │ │ +-rw---- 2.0 fat 904 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJException.class
│ │ │ +-rw---- 2.0 fat 1124 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJLoader.class
│ │ │ +-rw---- 2.0 fat 925 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJScalingFactor.class
│ │ │ +-rw---- 2.0 fat 1429 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJTransform.class
│ │ │ +-rw---- 2.0 fat 2469 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/TJTransformer.class
│ │ │ +-rw---- 2.0 fat 4552 bl defN 24-Mar-02 04:40 org/libjpegturbo/turbojpeg/YUVImage.class
│ │ │ 16 files, 112634 bytes uncompressed, 53932 bytes compressed: 52.1%
The jar
executable has a --date
option to normalize this, but there's currently no way to configure this in CMake (although I'd love to be corrected on this). Ideally the --date
flag would be set automatically if the SOURCE_DATE_EPOCH
environment variable is set to a value. This environment variable is already referenced at other places in the CMake codebase.
Thanks!