image_optim_pack 0.12.2.20260327 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +3 -1
- data/.github/workflows/build.yml +44 -24
- data/.github/workflows/check.yml +1 -2
- data/.rubocop.yml +3 -0
- data/CHANGELOG.markdown +12 -0
- data/Dockerfile +83 -83
- data/Dockerfile.debian +98 -92
- data/Makefile +41 -27
- data/checksums.mk +1 -1
- data/image_optim_pack-linux-aarch64-gnu.gemspec +3 -0
- data/image_optim_pack-linux-aarch64-musl.gemspec +3 -0
- data/image_optim_pack-linux-aarch64.gemspec +3 -0
- data/image_optim_pack-linux-x86_64-gnu.gemspec +3 -0
- data/image_optim_pack-linux-x86_64-musl.gemspec +3 -0
- data/image_optim_pack.gemspec +29 -21
- data/lib/image_optim/pack.rb +22 -5
- data/script/platform_downloads +6 -2
- data/script/run +36 -9
- data/spec/image_optim/pack_spec.rb +8 -2
- data/vendor/darwin-arm64/libpng.dylib +0 -0
- data/vendor/darwin-arm64/optipng +0 -0
- data/vendor/darwin-arm64/oxipng +0 -0
- data/vendor/darwin-arm64/pngcrush +0 -0
- data/vendor/darwin-arm64/pngquant +0 -0
- data/vendor/darwin-x86_64/libpng.dylib +0 -0
- data/vendor/darwin-x86_64/optipng +0 -0
- data/vendor/darwin-x86_64/pngcrush +0 -0
- data/vendor/darwin-x86_64/pngquant +0 -0
- data/vendor/linux-aarch64-gnu/advpng +0 -0
- data/vendor/linux-aarch64-gnu/gifsicle +0 -0
- data/vendor/linux-aarch64-gnu/jhead +0 -0
- data/vendor/linux-aarch64-gnu/jpeg-recompress +0 -0
- data/vendor/linux-aarch64-gnu/jpegoptim +0 -0
- data/vendor/linux-aarch64-gnu/jpegtran +0 -0
- data/vendor/linux-aarch64-gnu/libjpeg.so +0 -0
- data/vendor/linux-aarch64-gnu/liblcms2.so +0 -0
- data/vendor/linux-aarch64-gnu/libpng.so +0 -0
- data/vendor/linux-aarch64-gnu/libz.so +0 -0
- data/vendor/linux-aarch64-gnu/optipng +0 -0
- data/vendor/linux-aarch64-gnu/oxipng +0 -0
- data/vendor/linux-aarch64-gnu/pngcrush +0 -0
- data/vendor/linux-aarch64-gnu/pngout +0 -0
- data/vendor/linux-aarch64-gnu/pngquant +0 -0
- data/vendor/linux-aarch64-musl/advpng +0 -0
- data/vendor/linux-aarch64-musl/gifsicle +0 -0
- data/vendor/linux-aarch64-musl/jhead +0 -0
- data/vendor/linux-aarch64-musl/jpeg-recompress +0 -0
- data/vendor/linux-aarch64-musl/jpegoptim +0 -0
- data/vendor/linux-aarch64-musl/jpegtran +0 -0
- data/vendor/linux-aarch64-musl/libjpeg.so +0 -0
- data/vendor/linux-aarch64-musl/liblcms2.so +0 -0
- data/vendor/linux-aarch64-musl/libpng.so +0 -0
- data/vendor/linux-aarch64-musl/libz.so +0 -0
- data/vendor/linux-aarch64-musl/optipng +0 -0
- data/vendor/linux-aarch64-musl/oxipng +0 -0
- data/vendor/linux-aarch64-musl/pngcrush +0 -0
- data/vendor/linux-aarch64-musl/pngout +0 -0
- data/vendor/linux-aarch64-musl/pngquant +0 -0
- data/vendor/{linux-x86_64 → linux-x86_64-gnu}/libpng.so +0 -0
- data/vendor/{linux-x86_64 → linux-x86_64-gnu}/optipng +0 -0
- data/vendor/{linux-x86_64 → linux-x86_64-gnu}/pngcrush +0 -0
- data/vendor/{linux-x86_64 → linux-x86_64-gnu}/pngquant +0 -0
- data/vendor/linux-x86_64-musl/advpng +0 -0
- data/vendor/linux-x86_64-musl/gifsicle +0 -0
- data/vendor/linux-x86_64-musl/jhead +0 -0
- data/vendor/linux-x86_64-musl/jpeg-recompress +0 -0
- data/vendor/linux-x86_64-musl/jpegoptim +0 -0
- data/vendor/linux-x86_64-musl/jpegtran +0 -0
- data/vendor/linux-x86_64-musl/libjpeg.so +0 -0
- data/vendor/linux-x86_64-musl/liblcms2.so +0 -0
- data/vendor/linux-x86_64-musl/libpng.so +0 -0
- data/vendor/linux-x86_64-musl/libz.so +0 -0
- data/vendor/linux-x86_64-musl/optipng +0 -0
- data/vendor/linux-x86_64-musl/oxipng +0 -0
- data/vendor/linux-x86_64-musl/pngcrush +0 -0
- data/vendor/linux-x86_64-musl/pngout +0 -0
- data/vendor/linux-x86_64-musl/pngquant +0 -0
- metadata +67 -17
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/advpng +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/gifsicle +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/jhead +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/jpeg-recompress +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/jpegoptim +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/jpegtran +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/libjpeg.so +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/liblcms2.so +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/libz.so +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/oxipng +0 -0
- /data/vendor/{linux-x86_64 → linux-x86_64-gnu}/pngout +0 -0
data/Makefile
CHANGED
|
@@ -15,7 +15,7 @@ JPEGOPTIM_VER := 1.5.6
|
|
|
15
15
|
LIBJPEG_VER := 9f
|
|
16
16
|
LIBLCMS2_VER := 2.17
|
|
17
17
|
LIBMOZJPEG_VER := 4.1.5
|
|
18
|
-
LIBPNG_VER := 1.6.
|
|
18
|
+
LIBPNG_VER := 1.6.57
|
|
19
19
|
LIBZ_VER := 1.3.2
|
|
20
20
|
OPTIPNG_VER := 7.9.1
|
|
21
21
|
OXIPNG_VER := 10.1.0
|
|
@@ -41,15 +41,19 @@ IS_LINUX := $(findstring linux,$(OS))
|
|
|
41
41
|
IS_BSD := $(findstring bsd,$(OS))
|
|
42
42
|
IS_FREEBSD := $(findstring freebsd,$(OS))
|
|
43
43
|
IS_OPENBSD := $(findstring openbsd,$(OS))
|
|
44
|
+
|
|
45
|
+
IS_LINUX_MUSL := $(findstring linux-musl,$(shell gcc -dumpmachine))
|
|
46
|
+
|
|
44
47
|
DLEXT := $(if $(IS_DARWIN),.dylib,.so)
|
|
45
48
|
HOST := $(ARCH:arm64=arm)-$(if $(IS_DARWIN),apple,pc)-$(OS)
|
|
46
|
-
|
|
49
|
+
LIBC_SUFFIX := $(if $(IS_DARWIN),,$(if $(IS_LINUX_MUSL),-musl,-gnu))
|
|
50
|
+
RUST_HOST := $(ARCH:arm64=aarch64)-$(if $(IS_DARWIN),apple-darwin,unknown-linux$(LIBC_SUFFIX))
|
|
47
51
|
|
|
48
52
|
DL_DIR := $(CURDIR)/download
|
|
49
53
|
BUILD_ROOT_DIR := $(CURDIR)/build
|
|
50
|
-
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)-$(ARCH)
|
|
54
|
+
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)-$(ARCH)$(LIBC_SUFFIX)
|
|
51
55
|
OUTPUT_ROOT_DIR := $(CURDIR)/vendor
|
|
52
|
-
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)-$(ARCH)
|
|
56
|
+
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)-$(ARCH)$(LIBC_SUFFIX)
|
|
53
57
|
PATCHES_DIR := $(CURDIR)/patches
|
|
54
58
|
|
|
55
59
|
export CARGO_HOME := $(DL_DIR)/cargo
|
|
@@ -97,7 +101,6 @@ endef
|
|
|
97
101
|
# $1 - name of archive
|
|
98
102
|
# $2 - url of archive with [VER] for replace with version
|
|
99
103
|
# $3 - extension to use
|
|
100
|
-
# $4 - extra arguments to wget
|
|
101
104
|
define archive-dl
|
|
102
105
|
$(call archive,$1,$3)
|
|
103
106
|
# download archive from url
|
|
@@ -105,7 +108,7 @@ $$($1_ARC) :
|
|
|
105
108
|
mkdir -p $(DL_DIR)
|
|
106
109
|
test -w $(DL_DIR)
|
|
107
110
|
tmpfile=`mktemp "$$@.XXXXXXXXXX"` && \
|
|
108
|
-
wget -O "$$$$tmpfile" --no-use-server-timestamps
|
|
111
|
+
wget -O "$$$$tmpfile" --no-use-server-timestamps "$(subst [VER],$($1_VER),$(strip $2))" && \
|
|
109
112
|
chmod 644 "$$$$tmpfile" && \
|
|
110
113
|
mv "$$$$tmpfile" "$$@"
|
|
111
114
|
endef
|
|
@@ -123,9 +126,9 @@ $(eval $(call archive-dl,LIBZ, https://github.com/madler/zlib/archive/v[V
|
|
|
123
126
|
$(eval $(call archive-dl,OPTIPNG, https://prdownloads.sourceforge.net/optipng/optipng-[VER].tar.gz?download))
|
|
124
127
|
$(eval $(call archive-dl,OXIPNG, https://github.com/oxipng/oxipng/archive/v[VER].tar.gz))
|
|
125
128
|
$(eval $(call archive-dl,PNGCRUSH, https://prdownloads.sourceforge.net/pmt/pngcrush-[VER]-nolib.tar.gz?download))
|
|
126
|
-
$(eval $(call archive-dl,PNGOUT_LINUX,https://www.jonof.id.au/files/kenutils/pngout-[VER]-linux.tar.gz
|
|
127
|
-
$(eval $(call archive-dl,PNGOUT_LINUX_STATIC,https://www.jonof.id.au/files/kenutils/pngout-[VER]-linux-static.tar.gz
|
|
128
|
-
$(eval $(call archive-dl,PNGOUT_DARWIN,https://www.jonof.id.au/files/kenutils/pngout-[VER]-mac.zip,zip
|
|
129
|
+
$(eval $(call archive-dl,PNGOUT_LINUX,https://www.jonof.id.au/files/kenutils/pngout-[VER]-linux.tar.gz))
|
|
130
|
+
$(eval $(call archive-dl,PNGOUT_LINUX_STATIC,https://www.jonof.id.au/files/kenutils/pngout-[VER]-linux-static.tar.gz))
|
|
131
|
+
$(eval $(call archive-dl,PNGOUT_DARWIN,https://www.jonof.id.au/files/kenutils/pngout-[VER]-mac.zip,zip))
|
|
129
132
|
$(eval $(call archive-dl,PNGQUANT, https://crates.io/api/v1/crates/pngquant/[VER]/download))
|
|
130
133
|
|
|
131
134
|
download : $(foreach archive,$(ARCHIVES),$($(archive)_ARC))
|
|
@@ -205,6 +208,8 @@ $(eval $(call target,OXIPNG,,target/$(RUST_HOST)/release/oxipng))
|
|
|
205
208
|
$(eval $(call target,PNGCRUSH))
|
|
206
209
|
ifdef IS_DARWIN
|
|
207
210
|
$(eval $(call target,PNGOUT,PNGOUT_DARWIN,,NOSTRIP))
|
|
211
|
+
else ifdef IS_LINUX_MUSL
|
|
212
|
+
$(eval $(call target,PNGOUT,PNGOUT_LINUX_STATIC,,NOSTRIP))
|
|
208
213
|
else
|
|
209
214
|
$(eval $(call target,PNGOUT,PNGOUT_LINUX,,NOSTRIP))
|
|
210
215
|
endif
|
|
@@ -213,11 +218,7 @@ $(eval $(call target,PNGQUANT,,target/$(RUST_HOST)/release/pngquant))
|
|
|
213
218
|
# ====== TARGETS ======
|
|
214
219
|
|
|
215
220
|
all : build
|
|
216
|
-
ifeq ($(ARCH),$(HOST_ARCH))
|
|
217
221
|
@$(MAKE) test
|
|
218
|
-
else
|
|
219
|
-
@echo Skipping tests when compiling for different architecture
|
|
220
|
-
endif
|
|
221
222
|
.PHONY : all
|
|
222
223
|
|
|
223
224
|
build : $(call downcase,$(PRODUCTS))
|
|
@@ -232,11 +233,17 @@ endif
|
|
|
232
233
|
ldd-version :; $(ldd) --version
|
|
233
234
|
.PHONY : ldd-version
|
|
234
235
|
|
|
235
|
-
define
|
|
236
|
-
@test -
|
|
236
|
+
define check_file_presence
|
|
237
|
+
@test -e $(OUTPUT_DIR)/$1 || \
|
|
237
238
|
{ printf "%s: $(ANSI_RED)not found$(ANSI_RESET)\n" "$1"; exit 1; }
|
|
239
|
+
@test -f $(OUTPUT_DIR)/$1 || \
|
|
240
|
+
{ printf "%s: $(ANSI_RED)not a regular file$(ANSI_RESET)\n" "$1"; exit 1; }
|
|
241
|
+
@test -s $(OUTPUT_DIR)/$1 || \
|
|
242
|
+
{ printf "%s: $(ANSI_RED)has size zero$(ANSI_RESET)\n" "$1"; exit 1; }
|
|
238
243
|
endef
|
|
239
244
|
|
|
245
|
+
CHECK_VERSION := $(if $(findstring $(HOST_ARCH)/$(ARCH),x86_64/arm64),,check)
|
|
246
|
+
|
|
240
247
|
define check_version
|
|
241
248
|
@$(OUTPUT_DIR)/$1 $2 | fgrep -q "$3" || \
|
|
242
249
|
{ printf "%s: $(ANSI_RED)Expected %s, got %s$(ANSI_RESET)\n" "$1" "$3" "$$($(OUTPUT_DIR)/$1 $2)"; exit 1; }
|
|
@@ -248,26 +255,30 @@ define check_arch
|
|
|
248
255
|
endef
|
|
249
256
|
|
|
250
257
|
define check_output
|
|
251
|
-
@printf "%s: $(ANSI_GREEN)%s$(ANSI_RESET) / $(ANSI_MAGENTA)%s$(ANSI_RESET)\n" "$1" "$
|
|
258
|
+
@printf "%s: $(ANSI_GREEN)%s$(ANSI_RESET) / $(ANSI_MAGENTA)%s$(ANSI_RESET)\n" "$1" "$2" "$(ARCH_STRING)"
|
|
252
259
|
endef
|
|
253
260
|
|
|
254
261
|
define check_shlib
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
@if file $(OUTPUT_DIR)/$1 | fgrep -q 'statically linked'; then \
|
|
263
|
+
printf '\tstatically Linked\n'; \
|
|
264
|
+
else \
|
|
265
|
+
$(ldd) $(OUTPUT_DIR)/$1 | egrep "\s+.*/.*" && \
|
|
266
|
+
! $(ldd) $(OUTPUT_DIR)/$1 | egrep -o $$'[^: \t]+/[^: \t]+' | egrep -v "^(@loader_path|/lib|/lib64|/usr|$(OUTPUT_DIR))/"; \
|
|
267
|
+
fi
|
|
257
268
|
endef
|
|
258
269
|
|
|
259
270
|
define check_lib
|
|
260
|
-
$(call
|
|
271
|
+
$(call check_file_presence,$1)
|
|
261
272
|
$(call check_arch,$1)
|
|
262
|
-
$(call check_output,$1
|
|
273
|
+
$(call check_output,$1,-)
|
|
263
274
|
$(call check_shlib,$1)
|
|
264
275
|
endef
|
|
265
276
|
|
|
266
277
|
define check_bin
|
|
267
|
-
$(call
|
|
268
|
-
$(call check_version,$1,$2,$3)
|
|
278
|
+
$(call check_file_presence,$1)
|
|
279
|
+
$(if $(CHECK_VERSION),$(call check_version,$1,$2,$3))
|
|
269
280
|
$(call check_arch,$1)
|
|
270
|
-
$(call check_output,$1
|
|
281
|
+
$(call check_output,$1,$(if $(CHECK_VERSION),$3,[can't run $(ARCH) on $(HOST_ARCH)]))
|
|
271
282
|
$(call check_shlib,$1)
|
|
272
283
|
endef
|
|
273
284
|
|
|
@@ -275,9 +286,10 @@ ifdef IS_DARWIN
|
|
|
275
286
|
test : ARCH_STRING := $(ARCH)
|
|
276
287
|
else ifeq (amd64,$(ARCH:x86_64=amd64))
|
|
277
288
|
test : ARCH_STRING := x86-64
|
|
289
|
+
else
|
|
290
|
+
test : ARCH_STRING := $(ARCH)
|
|
278
291
|
endif
|
|
279
292
|
test :
|
|
280
|
-
$(if $(ARCH_STRING),,@echo Detecting 'ARCH $(ARCH) for OS $(OS) undefined'; false)
|
|
281
293
|
$(call check_bin,advpng,--version 2>&1,$(ADVANCECOMP_VER))
|
|
282
294
|
$(call check_bin,gifsicle,--version,$(GIFSICLE_VER))
|
|
283
295
|
$(call check_bin,jhead,-V,$(JHEAD_VER))
|
|
@@ -400,7 +412,6 @@ export CXX := g++
|
|
|
400
412
|
endif
|
|
401
413
|
|
|
402
414
|
GCC_FLAGS := -O3
|
|
403
|
-
STATIC_LIBGCC := $(shell if $(CC) -v 2>&1 | fgrep -q gcc; then echo -static-libgcc; fi)
|
|
404
415
|
|
|
405
416
|
export CFLAGS = $(GCC_FLAGS)
|
|
406
417
|
export CXXFLAGS = $(GCC_FLAGS)
|
|
@@ -519,6 +530,9 @@ $(OPTIPNG_TARGET) :
|
|
|
519
530
|
$(call chrpath_origin,$@)
|
|
520
531
|
|
|
521
532
|
## oxipng
|
|
533
|
+
ifdef IS_LINUX_MUSL
|
|
534
|
+
$(PNGQUANT_TARGET) : export RUSTFLAGS = -C target-feature=-crt-static
|
|
535
|
+
endif
|
|
522
536
|
$(OXIPNG_TARGET) :
|
|
523
537
|
cd $(DIR) && cargo build --release --frozen --offline --target=$(RUST_HOST)
|
|
524
538
|
|
|
@@ -539,13 +553,13 @@ $(PNGCRUSH_TARGET) :
|
|
|
539
553
|
## pngout
|
|
540
554
|
$(PNGOUT_TARGET) :
|
|
541
555
|
ifdef IS_LINUX
|
|
542
|
-
cd $(DIR) && ln -sf $(ARCH:x86_64=amd64)/pngout
|
|
556
|
+
cd $(DIR) && ln -sf $(ARCH:x86_64=amd64)/pngout$(if $(IS_LINUX_MUSL),-static) pngout
|
|
543
557
|
endif
|
|
544
558
|
cd $(DIR) && touch pngout
|
|
545
559
|
|
|
546
560
|
## pngquant
|
|
547
561
|
$(eval $(call depend,PNGQUANT,LIBLCMS2 LIBPNG LIBZ))
|
|
548
|
-
$(PNGQUANT_TARGET) : export RUSTFLAGS = -C link-arg=$(XORIGIN)
|
|
562
|
+
$(PNGQUANT_TARGET) : export RUSTFLAGS = -C link-arg=$(XORIGIN) $(if $(IS_LINUX_MUSL),-C target-feature=-crt-static)
|
|
549
563
|
$(PNGQUANT_TARGET) :
|
|
550
564
|
printf "%s\n" \
|
|
551
565
|
$(foreach LIB,PNG Z LCMS2, \
|
data/checksums.mk
CHANGED
|
@@ -6,7 +6,7 @@ JPEGOPTIM_SHA256 := 661a808dfffa933d78c6beb47a2937d572b9f03e94cbaaab3d4c0d72f410
|
|
|
6
6
|
LIBJPEG_SHA256 := 04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b
|
|
7
7
|
LIBLCMS2_SHA256 := d11af569e42a1baa1650d20ad61d12e41af4fead4aa7964a01f93b08b53ab074
|
|
8
8
|
LIBMOZJPEG_SHA256 := 9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed0998fcc1
|
|
9
|
-
LIBPNG_SHA256 :=
|
|
9
|
+
LIBPNG_SHA256 := 01fdab044cdc575c74a9ef62a4042fbe24fea8bedfe8aa5c89f4467b781bbb60
|
|
10
10
|
LIBZ_SHA256 := b99a0b86c0ba9360ec7e78c4f1e43b1cbdf1e6936c8fa0f6835c0cd694a495a1
|
|
11
11
|
OPTIPNG_SHA256 := c2579be58c2c66dae9d63154edcb3d427fef64cb00ec0aff079c9d156ec46f29
|
|
12
12
|
OXIPNG_SHA256 := 6c5e1d021a844ba730193943ab63ad99e7d9f1089c36f3db59014517ea99cf99
|
data/image_optim_pack.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'image_optim_pack'
|
|
5
|
-
s.version = '0.
|
|
5
|
+
s.version = '0.13.1'
|
|
6
6
|
s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant}
|
|
7
7
|
s.homepage = "https://github.com/toy/#{s.name}"
|
|
8
8
|
s.authors = ['Ivan Kuchin']
|
|
@@ -17,38 +17,46 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
'source_code_uri' => "https://github.com/toy/#{s.name}",
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
s.files
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
s.files = Dir[*%w[
|
|
21
|
+
.dockerignore
|
|
22
|
+
.gitignore
|
|
23
|
+
.rubocop.yml
|
|
24
|
+
checksums.mk
|
|
25
|
+
Gemfile
|
|
26
|
+
LICENSE.txt
|
|
27
|
+
Makefile
|
|
28
|
+
*.markdown
|
|
29
|
+
Dockerfile*
|
|
30
|
+
*.gemspec
|
|
31
|
+
{.github,acknowledgements,lib,patches,script,spec,vendor}/**/*
|
|
32
|
+
]].reject(&File.method(:directory?))
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
if defined?(gemspec_path)
|
|
35
|
+
platform_parts = File.basename(gemspec_path, File.extname(gemspec_path)).split('-').drop(1)
|
|
36
|
+
s.platform = Gem::Platform.new(platform_parts.values_at(1, 0, 2))
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
'
|
|
28
|
-
|
|
38
|
+
all_vendor_dirs = s.files.filter_map do |path|
|
|
39
|
+
parts = path.split('/')
|
|
40
|
+
parts[1] if parts[0] == 'vendor'
|
|
41
|
+
end.uniq
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
vendor_dirs = all_vendor_dirs.select do |vendor_dir|
|
|
44
|
+
s.platform =~ Gem::Platform.new(vendor_dir.split('-').values_at(1, 0, 2))
|
|
32
45
|
end
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
File.directory?(File.join('vendor', vendor_dir))
|
|
36
|
-
end
|
|
47
|
+
expected_vendor_dirs = s.platform.os == 'linux' && !s.platform.version ? 2 : 1
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
else
|
|
41
|
-
message = existing_vendor_dirs.empty? ? 'no vendor dir' : 'multiple vendor dirs'
|
|
42
|
-
fail "#{message} found for os #{gem_os} and cpu #{gem_cpu} out of: #{possible_vendor_dirs.join(', ')}"
|
|
49
|
+
unless vendor_dirs.length == expected_vendor_dirs
|
|
50
|
+
fail "expected #{expected_vendor_dirs}, got #{vendor_dirs.length} (#{vendor_dirs.join(', ')}) for #{s.platform}"
|
|
43
51
|
end
|
|
44
52
|
|
|
45
53
|
s.files.reject! do |path|
|
|
46
54
|
parts = path.split('/')
|
|
47
|
-
parts[0] == 'vendor' && parts[1]
|
|
55
|
+
parts[0] == 'vendor' && !vendor_dirs.include?(parts[1])
|
|
48
56
|
end
|
|
49
57
|
end
|
|
50
|
-
|
|
51
|
-
s.
|
|
58
|
+
|
|
59
|
+
s.test_files = Dir['spec/**/*.*']
|
|
52
60
|
s.require_paths = %w[lib]
|
|
53
61
|
|
|
54
62
|
s.add_dependency 'image_optim', '~> 0.19'
|
data/lib/image_optim/pack.rb
CHANGED
|
@@ -15,13 +15,16 @@ class ImageOptim
|
|
|
15
15
|
# Intended os
|
|
16
16
|
attr_reader :os
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# Intended architecture
|
|
19
19
|
attr_reader :arch
|
|
20
20
|
|
|
21
|
+
# Intended version
|
|
22
|
+
attr_reader :version
|
|
23
|
+
|
|
21
24
|
# Receive path, use last part for arch and last but one part for os
|
|
22
25
|
def initialize(path)
|
|
23
26
|
@path = FSPath(path)
|
|
24
|
-
@os, @arch = @path.basename.to_s.split('-',
|
|
27
|
+
@os, @arch, @version = @path.basename.to_s.split('-', 3)
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
# Return path converted to string
|
|
@@ -78,6 +81,15 @@ class ImageOptim
|
|
|
78
81
|
'unknown'
|
|
79
82
|
end
|
|
80
83
|
|
|
84
|
+
# extracted from ldd output
|
|
85
|
+
VERSION = if OS == 'linux'
|
|
86
|
+
begin
|
|
87
|
+
`ldd /bin/sh`[/musl|gnu/]
|
|
88
|
+
rescue Errno::ENOENT
|
|
89
|
+
'unknown'
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
81
93
|
# Path to vendor at root of image_optim_pack
|
|
82
94
|
VENDOR_PATH = FSPath('../../../vendor').expand_path(__FILE__)
|
|
83
95
|
|
|
@@ -96,10 +108,15 @@ class ImageOptim
|
|
|
96
108
|
|
|
97
109
|
private
|
|
98
110
|
|
|
99
|
-
# Order by match of os and
|
|
111
|
+
# Order by match of os, arch and version
|
|
100
112
|
def ordered_by_os_arch_match
|
|
101
|
-
PATHS.sort_by do |path|
|
|
102
|
-
[
|
|
113
|
+
PATHS.sort_by.with_index do |path, i|
|
|
114
|
+
[
|
|
115
|
+
path.os == OS ? 0 : 1,
|
|
116
|
+
path.arch == ARCH ? 0 : 1,
|
|
117
|
+
path.version == VERSION ? 0 : 1,
|
|
118
|
+
i,
|
|
119
|
+
]
|
|
103
120
|
end
|
|
104
121
|
end
|
|
105
122
|
|
data/script/platform_downloads
CHANGED
|
@@ -5,13 +5,17 @@ require 'gems'
|
|
|
5
5
|
require 'ostruct'
|
|
6
6
|
require 'terminal-table'
|
|
7
7
|
|
|
8
|
+
def platform_parts(platform)
|
|
9
|
+
platform.split('-', 3).values_at(1, 0, 2).compact
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
versions = Gems.versions('image_optim_pack').map do |attributes|
|
|
9
13
|
attributes['number'] = Gem::Version.new(attributes['number'])
|
|
10
14
|
OpenStruct.new(attributes) # rubocop:disable Style/OpenStructUse
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
platforms = versions.map(&:platform).uniq.sort_by do |platform|
|
|
14
|
-
platform
|
|
18
|
+
platform_parts(platform)
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
version_time = begin
|
|
@@ -28,7 +32,7 @@ end
|
|
|
28
32
|
table = Terminal::Table.new
|
|
29
33
|
|
|
30
34
|
table.headings = ['version', 'days', 'base dls'] + platforms.map do |platform|
|
|
31
|
-
platform
|
|
35
|
+
platform_parts(platform).join("\n")
|
|
32
36
|
end + ['total']
|
|
33
37
|
|
|
34
38
|
versions.group_by(&:number).each do |version_n, platform_versions|
|
data/script/run
CHANGED
|
@@ -62,6 +62,7 @@ fi
|
|
|
62
62
|
container_build() {
|
|
63
63
|
vm=$1
|
|
64
64
|
image=$2
|
|
65
|
+
platform=$3
|
|
65
66
|
|
|
66
67
|
passes-filter "$vm" || return 0
|
|
67
68
|
header "$vm"
|
|
@@ -74,7 +75,15 @@ container_build() {
|
|
|
74
75
|
|
|
75
76
|
if [[ -n "$used_image" && "$used_image" != "$image" ]]; then
|
|
76
77
|
echo "Container is using $used_image instead of $image, recreating"
|
|
77
|
-
"$container_tool" rm "$container_name"
|
|
78
|
+
"$container_tool" rm --force "$container_name"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
used_image_id=$("$container_tool" inspect --format '{{.Image}}' "$container_name" 2>/dev/null || true)
|
|
82
|
+
used_platform=$("$container_tool" inspect --format '{{.Os}}/{{.Architecture}}' "$used_image_id" 2>/dev/null || true)
|
|
83
|
+
|
|
84
|
+
if [[ -n "$used_platform" && "$used_platform" != "$platform" ]]; then
|
|
85
|
+
echo "Container is using image platform $used_platform instead of $platform, recreating"
|
|
86
|
+
"$container_tool" rm --force "$container_name"
|
|
78
87
|
fi
|
|
79
88
|
|
|
80
89
|
status=$("$container_tool" inspect --format '{{.State.Status}}' "$container_name" 2>/dev/null || true)
|
|
@@ -84,7 +93,8 @@ container_build() {
|
|
|
84
93
|
|
|
85
94
|
"$container_tool" \
|
|
86
95
|
container create \
|
|
87
|
-
--
|
|
96
|
+
--platform "$platform" \
|
|
97
|
+
--name "$container_name" \
|
|
88
98
|
--stop-signal SIGHUP \
|
|
89
99
|
-it \
|
|
90
100
|
-v "${mount//_path_/}:ro" \
|
|
@@ -95,9 +105,16 @@ container_build() {
|
|
|
95
105
|
|
|
96
106
|
"$container_tool" container start "$container_name"
|
|
97
107
|
|
|
98
|
-
"$container_tool" exec -it "$container_name"
|
|
99
|
-
apt-get
|
|
100
|
-
|
|
108
|
+
"$container_tool" exec -it "$container_name" sh -exc "
|
|
109
|
+
if command -v apt-get; then
|
|
110
|
+
apt-get update
|
|
111
|
+
apt-get -y install make gcc g++ chrpath perl pkg-config autoconf automake libtool nasm cmake patch
|
|
112
|
+
elif command -v apk; then
|
|
113
|
+
apk add --no-cache bash make gcc g++ chrpath perl pkgconf autoconf automake libtool nasm cmake patch file
|
|
114
|
+
else
|
|
115
|
+
echo 'unsupported package manager' >&2
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
101
118
|
"
|
|
102
119
|
fi
|
|
103
120
|
|
|
@@ -113,8 +130,16 @@ container_build() {
|
|
|
113
130
|
exit 0
|
|
114
131
|
fi
|
|
115
132
|
|
|
116
|
-
apt-get
|
|
117
|
-
|
|
133
|
+
if command -v apt-get; then
|
|
134
|
+
apt-get update
|
|
135
|
+
apt-get -y dist-upgrade
|
|
136
|
+
elif command -v apk; then
|
|
137
|
+
apk upgrade --no-cache
|
|
138
|
+
else
|
|
139
|
+
echo 'unsupported package manager' >&2
|
|
140
|
+
exit 1
|
|
141
|
+
fi
|
|
142
|
+
|
|
118
143
|
rustup update
|
|
119
144
|
|
|
120
145
|
touch \"\$UPDATED_FILE\"
|
|
@@ -136,5 +161,7 @@ container_build() {
|
|
|
136
161
|
[[ -n "$NO_HALT" ]] || "$container_tool" container stop "$container_name"
|
|
137
162
|
}
|
|
138
163
|
|
|
139
|
-
|
|
140
|
-
container_build linux-x86_64 rust:
|
|
164
|
+
container_build linux-x86_64-gnu rust:slim-bullseye linux/amd64
|
|
165
|
+
container_build linux-x86_64-musl rust:alpine linux/amd64
|
|
166
|
+
container_build linux-aarch64-gnu rust:slim-bookworm linux/arm64
|
|
167
|
+
container_build linux-aarch64-musl rust:alpine linux/arm64
|
|
@@ -39,13 +39,19 @@ describe ImageOptim::Pack do
|
|
|
39
39
|
|
|
40
40
|
describe :os do
|
|
41
41
|
it 'returns last but one part of path' do
|
|
42
|
-
expect(Path.new('path/futureos-
|
|
42
|
+
expect(Path.new('path/futureos-K_qbit-foo-bar')).to have_attributes(os: 'futureos')
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
describe :arch do
|
|
47
47
|
it 'returns last but one part of path' do
|
|
48
|
-
expect(Path.new('path/futureos-
|
|
48
|
+
expect(Path.new('path/futureos-K_qbit-foo-bar')).to have_attributes(arch: 'K_qbit')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe :version do
|
|
53
|
+
it 'returns last but one part of path' do
|
|
54
|
+
expect(Path.new('path/futureos-K_qbit-foo-bar')).to have_attributes(version: 'foo-bar')
|
|
49
55
|
end
|
|
50
56
|
end
|
|
51
57
|
|
|
Binary file
|
data/vendor/darwin-arm64/optipng
CHANGED
|
Binary file
|
data/vendor/darwin-arm64/oxipng
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|