image_optim_pack 0.5.0-x86-freebsd
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 +7 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +79 -0
- data/.travis.yml +35 -0
- data/CHANGELOG.markdown +210 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +27 -0
- data/Makefile +393 -0
- data/README.markdown +93 -0
- data/Vagrantfile +60 -0
- data/acknowledgements/7z.txt +56 -0
- data/acknowledgements/advancecomp.txt +674 -0
- data/acknowledgements/bmp2png.txt +8 -0
- data/acknowledgements/cexcept.txt +8 -0
- data/acknowledgements/gifread.txt +14 -0
- data/acknowledgements/gifsicle.txt +343 -0
- data/acknowledgements/iqa.txt +30 -0
- data/acknowledgements/jhead.txt +12 -0
- data/acknowledgements/jpeg-archive.txt +20 -0
- data/acknowledgements/jpegoptim.txt +339 -0
- data/acknowledgements/libjpeg-turbo.txt +27 -0
- data/acknowledgements/libjpeg-x86-simd.txt +17 -0
- data/acknowledgements/libjpeg.txt +64 -0
- data/acknowledgements/libpng.txt +90 -0
- data/acknowledgements/mozjpeg.txt +7 -0
- data/acknowledgements/optipng-authors.txt +26 -0
- data/acknowledgements/optipng.txt +21 -0
- data/acknowledgements/pngcrush.txt +35 -0
- data/acknowledgements/pngquant.txt +56 -0
- data/acknowledgements/smallfry.txt +13 -0
- data/acknowledgements/zlib.txt +34 -0
- data/acknowledgements/zopfli-contributors.txt +6 -0
- data/acknowledgements/zopfli.txt +201 -0
- data/boxes/.gitignore +3 -0
- data/boxes/.rubocop.yml +13 -0
- data/boxes/Gemfile +11 -0
- data/boxes/Rakefile +144 -0
- data/boxes/definitions/freebsd-amd64/definition.rb +38 -0
- data/boxes/definitions/freebsd-amd64/install.sh +66 -0
- data/boxes/definitions/freebsd-i386/definition.rb +38 -0
- data/boxes/definitions/freebsd-i386/install.sh +66 -0
- data/boxes/definitions/freebsd-postinstall.sh +38 -0
- data/boxes/definitions/openbsd-amd64/definition.rb +71 -0
- data/boxes/definitions/openbsd-i386/definition.rb +71 -0
- data/boxes/definitions/openbsd-postinstall.sh +29 -0
- data/image_optim_pack-darwin-x86.gemspec +3 -0
- data/image_optim_pack-darwin-x86_64.gemspec +3 -0
- data/image_optim_pack-freebsd-amd64.gemspec +3 -0
- data/image_optim_pack-freebsd-x86.gemspec +3 -0
- data/image_optim_pack-linux-x86.gemspec +3 -0
- data/image_optim_pack-linux-x86_64.gemspec +3 -0
- data/image_optim_pack-openbsd-x86.gemspec +3 -0
- data/image_optim_pack-openbsd-x86_64.gemspec +3 -0
- data/image_optim_pack.gemspec +41 -0
- data/lib/image_optim/pack.rb +117 -0
- data/lib/image_optim_pack.rb +1 -0
- data/script/livecheck +116 -0
- data/script/run +71 -0
- data/script/update_versions +22 -0
- data/spec/image_optim/pack_spec.rb +114 -0
- data/spec/image_optim_spec.rb +39 -0
- data/spec/spec_helper.rb +8 -0
- data/vendor/freebsd-i386/advpng +0 -0
- data/vendor/freebsd-i386/gifsicle +0 -0
- data/vendor/freebsd-i386/jhead +0 -0
- data/vendor/freebsd-i386/jpeg-recompress +0 -0
- data/vendor/freebsd-i386/jpegoptim +0 -0
- data/vendor/freebsd-i386/jpegtran +0 -0
- data/vendor/freebsd-i386/libjpeg.so +0 -0
- data/vendor/freebsd-i386/libpng.so +0 -0
- data/vendor/freebsd-i386/libz.so +0 -0
- data/vendor/freebsd-i386/optipng +0 -0
- data/vendor/freebsd-i386/pngcrush +0 -0
- data/vendor/freebsd-i386/pngquant +0 -0
- metadata +182 -0
data/Makefile
ADDED
@@ -0,0 +1,393 @@
|
|
1
|
+
all :
|
2
|
+
|
3
|
+
# ====== VERSIONS ======
|
4
|
+
|
5
|
+
ADVANCECOMP_VER := 1.23
|
6
|
+
GIFSICLE_VER := 1.88
|
7
|
+
JHEAD_VER := 3.00
|
8
|
+
JPEGARCHIVE_VER := 2.1.1
|
9
|
+
JPEGOPTIM_VER := 1.4.4
|
10
|
+
LIBJPEG_VER := 9b
|
11
|
+
LIBMOZJPEG_VER := 3.1
|
12
|
+
LIBPNG_VER := 1.6.29
|
13
|
+
LIBZ_VER := 1.2.11
|
14
|
+
OPTIPNG_VER := 0.7.6
|
15
|
+
PNGCRUSH_VER := 1.8.11
|
16
|
+
PNGQUANT_VER := 2.9.1
|
17
|
+
|
18
|
+
# ====== CONSTANTS ======
|
19
|
+
|
20
|
+
OS := $(shell uname -s | tr A-Z a-z)
|
21
|
+
ARCH := $(shell uname -m)
|
22
|
+
|
23
|
+
IS_DARWIN := $(findstring darwin,$(OS))
|
24
|
+
IS_LINUX := $(findstring linux,$(OS))
|
25
|
+
IS_BSD := $(findstring bsd,$(OS))
|
26
|
+
IS_FREEBSD := $(findstring freebsd,$(OS))
|
27
|
+
IS_OPENBSD := $(findstring openbsd,$(OS))
|
28
|
+
DLEXT := $(if $(IS_DARWIN),.dylib,.so)
|
29
|
+
HOST := $(ARCH)-$(if $(IS_DARWIN),apple,pc)-$(OS)
|
30
|
+
|
31
|
+
DL_DIR := $(CURDIR)/download
|
32
|
+
BUILD_ROOT_DIR := $(CURDIR)/build
|
33
|
+
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)-$(ARCH)
|
34
|
+
OUTPUT_ROOT_DIR := $(CURDIR)/vendor
|
35
|
+
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)-$(ARCH)
|
36
|
+
$(shell mkdir -p $(DL_DIR) $(BUILD_DIR) $(OUTPUT_DIR))
|
37
|
+
|
38
|
+
ANSI_RED=\033[31m
|
39
|
+
ANSI_GREEN=\033[32m
|
40
|
+
ANSI_MAGENTA=\033[35m
|
41
|
+
ANSI_RESET=\033[0m
|
42
|
+
|
43
|
+
# ====== HELPERS ======
|
44
|
+
|
45
|
+
downcase = $(shell echo $1 | tr A-Z a-z)
|
46
|
+
|
47
|
+
ln_s := ln -sf
|
48
|
+
tar := $(shell if command -v gtar >/dev/null 2>&1; then echo gtar; else echo tar; fi)
|
49
|
+
|
50
|
+
# ====== ARCHIVES ======
|
51
|
+
|
52
|
+
ARCHIVES :=
|
53
|
+
|
54
|
+
# $1 - name of archive
|
55
|
+
define archive
|
56
|
+
ARCHIVES += $1
|
57
|
+
$1_DIR := $(BUILD_DIR)/$(call downcase,$1)
|
58
|
+
$1_TGZ := $(DL_DIR)/$(call downcase,$1)-$($1_VER).tar.gz
|
59
|
+
$1_EXTRACTED := $$($1_DIR)/__$$(notdir $$($1_TGZ))__
|
60
|
+
$$($1_EXTRACTED) : $$($1_TGZ)
|
61
|
+
rm -rf $$(@D)
|
62
|
+
mkdir $$(@D)
|
63
|
+
$(tar) -C $$(@D) --strip-components=1 -xzf $$<
|
64
|
+
touch $$(@D)/__$$(notdir $$<)__
|
65
|
+
endef
|
66
|
+
|
67
|
+
# $1 - name of archive
|
68
|
+
# $2 - url of archive with [VER] for replace with version
|
69
|
+
define archive-dl
|
70
|
+
$(call archive,$1)
|
71
|
+
# download archive from url
|
72
|
+
$$($1_TGZ) :
|
73
|
+
while ! mkdir $$@.lock 2> /dev/null; do sleep 1; done
|
74
|
+
wget -q -O $$@.tmp $(subst [VER],$($1_VER),$(strip $2))
|
75
|
+
mv $$@.tmp $$@
|
76
|
+
rm -r $$@.lock
|
77
|
+
endef
|
78
|
+
|
79
|
+
$(eval $(call archive-dl,ADVANCECOMP, https://github.com/amadvance/advancecomp/releases/download/v[VER]/advancecomp-[VER].tar.gz))
|
80
|
+
$(eval $(call archive-dl,GIFSICLE, http://www.lcdf.org/gifsicle/gifsicle-[VER].tar.gz))
|
81
|
+
$(eval $(call archive-dl,JHEAD, http://www.sentex.net/~mwandel/jhead/jhead-[VER].tar.gz))
|
82
|
+
$(eval $(call archive-dl,JPEGARCHIVE, https://github.com/danielgtaylor/jpeg-archive/archive/[VER].tar.gz))
|
83
|
+
$(eval $(call archive-dl,JPEGOPTIM, http://www.kokkonen.net/tjko/src/jpegoptim-[VER].tar.gz))
|
84
|
+
$(eval $(call archive-dl,LIBJPEG, http://www.ijg.org/files/jpegsrc.v[VER].tar.gz))
|
85
|
+
$(eval $(call archive-dl,LIBMOZJPEG, https://github.com/mozilla/mozjpeg/archive/v[VER].tar.gz))
|
86
|
+
$(eval $(call archive-dl,LIBPNG, http://prdownloads.sourceforge.net/libpng/libpng-[VER].tar.gz?download))
|
87
|
+
$(eval $(call archive-dl,LIBZ, http://prdownloads.sourceforge.net/libpng/zlib-[VER].tar.gz?download))
|
88
|
+
$(eval $(call archive-dl,OPTIPNG, http://prdownloads.sourceforge.net/optipng/optipng-[VER].tar.gz?download))
|
89
|
+
$(eval $(call archive-dl,PNGCRUSH, http://prdownloads.sourceforge.net/pmt/pngcrush-[VER]-nolib.tar.gz?download))
|
90
|
+
$(eval $(call archive,PNGQUANT))
|
91
|
+
|
92
|
+
PNGQUANT_GIT := $(DL_DIR)/pngquant.git
|
93
|
+
$(PNGQUANT_GIT) :; git clone --recursive https://github.com/pornel/pngquant.git $@
|
94
|
+
$(PNGQUANT_TGZ) : $(PNGQUANT_GIT)
|
95
|
+
while ! mkdir $@.lock 2> /dev/null; do sleep 1; done
|
96
|
+
cd $(PNGQUANT_GIT) && git fetch && git checkout -q $(PNGQUANT_VER) && git submodule -q update
|
97
|
+
cd $(PNGQUANT_GIT) && $(tar) --exclude=.git -czf $(PNGQUANT_TGZ) .
|
98
|
+
rm -r $@.lock
|
99
|
+
|
100
|
+
download : $(foreach archive,$(ARCHIVES),$($(archive)_TGZ))
|
101
|
+
.PHONY : download
|
102
|
+
|
103
|
+
download-tidy-up :
|
104
|
+
rm -f $(filter-out $(foreach archive,$(ARCHIVES),$($(archive)_TGZ)) $(PNGQUANT_GIT),$(wildcard $(DL_DIR)/*.*))
|
105
|
+
.PHONY : download-tidy-up
|
106
|
+
|
107
|
+
# ====== PRODUCTS ======
|
108
|
+
|
109
|
+
PRODUCTS :=
|
110
|
+
|
111
|
+
# $1 - product name
|
112
|
+
# $2 - archive name ($1 if empty)
|
113
|
+
# $3 - path ($1 if empty)
|
114
|
+
define target-build
|
115
|
+
$1_PATH := $(or $3,$(call downcase,$1))
|
116
|
+
$1_BASENAME := $$(notdir $$($1_PATH))
|
117
|
+
$1_DIR := $($(or $2,$1)_DIR)
|
118
|
+
$1_TGZ := $($(or $2,$1)_TGZ)
|
119
|
+
$1_EXTRACTED := $($(or $2,$1)_EXTRACTED)
|
120
|
+
$1_TARGET := $$($1_DIR)/$$($1_PATH)
|
121
|
+
$$($1_TARGET) : DIR := $$($1_DIR)
|
122
|
+
$$($1_TARGET) : $$($1_EXTRACTED)
|
123
|
+
endef
|
124
|
+
|
125
|
+
# $1 - product name
|
126
|
+
# $2 - archive name ($1 if empty)
|
127
|
+
# $3 - basename ($1 if empty)
|
128
|
+
define target
|
129
|
+
$(call target-build,$1,$2,$3)
|
130
|
+
PRODUCTS += $1
|
131
|
+
$1_DESTINATION := $$(OUTPUT_DIR)/$$($1_BASENAME)
|
132
|
+
# copy product to output dir
|
133
|
+
$$($1_DESTINATION) : $$($1_TARGET)
|
134
|
+
temppath=`mktemp "$(BUILD_DIR)"/tmp.XXXXXXXXXX` && \
|
135
|
+
strip $$< -Sx -o "$$$$temppath" && \
|
136
|
+
chmod 755 "$$$$temppath" && \
|
137
|
+
mv "$$$$temppath" $$@
|
138
|
+
# short name target
|
139
|
+
$(call downcase,$1) : | $$($1_DESTINATION)
|
140
|
+
endef
|
141
|
+
|
142
|
+
$(eval $(call target,ADVPNG,ADVANCECOMP))
|
143
|
+
$(eval $(call target,GIFSICLE,,src/gifsicle))
|
144
|
+
$(eval $(call target,JHEAD))
|
145
|
+
$(eval $(call target,JPEG-RECOMPRESS,JPEGARCHIVE))
|
146
|
+
$(eval $(call target,JPEGOPTIM))
|
147
|
+
$(eval $(call target,JPEGTRAN,LIBJPEG,.libs/jpegtran))
|
148
|
+
$(eval $(call target,LIBJPEG,,libjpeg$(DLEXT)))
|
149
|
+
$(eval $(call target-build,LIBMOZJPEG,,libjpeg.a))
|
150
|
+
$(eval $(call target,LIBPNG,,libpng$(DLEXT)))
|
151
|
+
$(eval $(call target,LIBZ,,libz$(DLEXT)))
|
152
|
+
$(eval $(call target,OPTIPNG,,src/optipng/optipng))
|
153
|
+
$(eval $(call target,PNGCRUSH))
|
154
|
+
$(eval $(call target,PNGQUANT))
|
155
|
+
|
156
|
+
# ====== TARGETS ======
|
157
|
+
|
158
|
+
all : build
|
159
|
+
@$(MAKE) test
|
160
|
+
.PHONY : all
|
161
|
+
|
162
|
+
build : $(call downcase,$(PRODUCTS))
|
163
|
+
.PHONY : build
|
164
|
+
|
165
|
+
define check_bin
|
166
|
+
@test -f $(OUTPUT_DIR)/$1 || \
|
167
|
+
{ printf "$(ANSI_RED)no $1 found$(ANSI_RESET)\n"; exit 1; }
|
168
|
+
@printf "$1: "; \
|
169
|
+
VERSION=$$($(OUTPUT_DIR)/$1 $2 | fgrep -o $3) || \
|
170
|
+
{ printf "$(ANSI_RED)Expected $3, got $$($(OUTPUT_DIR)/$1 $2)$(ANSI_RESET)\n"; exit 1; }; \
|
171
|
+
ARCH=$$(file -b $(OUTPUT_DIR)/$1 | fgrep -o '$(ARCH_STRING)') || \
|
172
|
+
{ printf "$(ANSI_RED)Expected $(ARCH_STRING), got $$(file -b $(OUTPUT_DIR)/$1)$(ANSI_RESET)\n"; exit 1; }; \
|
173
|
+
printf "$(ANSI_GREEN)$$VERSION$(ANSI_RESET) / $(ANSI_MAGENTA)$$ARCH$(ANSI_RESET)\n"
|
174
|
+
endef
|
175
|
+
|
176
|
+
ifdef IS_DARWIN
|
177
|
+
test : ARCH_STRING := $(ARCH)
|
178
|
+
else ifeq (i386,$(ARCH:i686=i386))
|
179
|
+
test : ARCH_STRING := 80386
|
180
|
+
else ifeq (amd64,$(ARCH:x86_64=amd64))
|
181
|
+
test : ARCH_STRING := x86-64
|
182
|
+
endif
|
183
|
+
test :
|
184
|
+
$(if $(ARCH_STRING),,@echo Detecting 'ARCH $(ARCH) for OS $(OS) undefined'; false)
|
185
|
+
$(call check_bin,advpng,--version 2>&1,$(ADVANCECOMP_VER))
|
186
|
+
$(call check_bin,gifsicle,--version,$(GIFSICLE_VER))
|
187
|
+
$(call check_bin,jhead,-V,$(JHEAD_VER))
|
188
|
+
$(call check_bin,jpeg-recompress,--version,$(JPEGARCHIVE_VER))
|
189
|
+
$(call check_bin,jpegoptim,--version,$(JPEGOPTIM_VER))
|
190
|
+
$(call check_bin,jpegtran,-v - 2>&1,$(LIBJPEG_VER))
|
191
|
+
$(call check_bin,optipng,--version,$(OPTIPNG_VER))
|
192
|
+
$(call check_bin,pngcrush,-version 2>&1,$(PNGCRUSH_VER))
|
193
|
+
$(call check_bin,pngquant,--help,$(PNGQUANT_VER))
|
194
|
+
.PHONY : test
|
195
|
+
|
196
|
+
livecheck :; @$(foreach archive,$(ARCHIVES),script/livecheck $(call downcase,$(archive)) $($(archive)_VER);)
|
197
|
+
.PHONY : livecheck
|
198
|
+
|
199
|
+
Makefile.updated :
|
200
|
+
cat Makefile | script/update_versions > Makefile.updated
|
201
|
+
|
202
|
+
update-versions : Makefile.updated
|
203
|
+
mv Makefile.updated Makefile
|
204
|
+
.PHONY : update-versions
|
205
|
+
|
206
|
+
# ====== CLEAN ======
|
207
|
+
|
208
|
+
clean :
|
209
|
+
rm -rf $(BUILD_DIR)
|
210
|
+
rm -rf $(OUTPUT_DIR)
|
211
|
+
.PHONY : clean
|
212
|
+
|
213
|
+
clean-all :
|
214
|
+
rm -rf $(BUILD_ROOT_DIR)
|
215
|
+
rm -rf $(OUTPUT_ROOT_DIR)
|
216
|
+
.PHONY : clean-all
|
217
|
+
|
218
|
+
clobber : clean-all
|
219
|
+
rm -rf $(DL_DIR)
|
220
|
+
.PHONY : clobber
|
221
|
+
|
222
|
+
# ====== BUILD HELPERS ======
|
223
|
+
|
224
|
+
# $1 - name of product
|
225
|
+
# $2 - list of dependency products
|
226
|
+
define depend-build
|
227
|
+
# depend this product on every specified product
|
228
|
+
$($1_EXTRACTED) : $$(filter-out $($1_EXTRACTED),$(foreach dep,$2,$$($(dep)_EXTRACTED)))
|
229
|
+
$($1_TARGET) : $(foreach dep,$2,$$($(dep)_TARGET))
|
230
|
+
# add dependent product dir to CPATH, LIBRARY_PATH and PKG_CONFIG_PATH
|
231
|
+
$($1_TARGET) : export CPATH := $(subst $(eval) ,:,$(foreach dep,$2,$$($(dep)_DIR)))
|
232
|
+
$($1_TARGET) : export LIBRARY_PATH := $$(CPATH)
|
233
|
+
$($1_TARGET) : export PKG_CONFIG_PATH := $$(CPATH)
|
234
|
+
endef
|
235
|
+
|
236
|
+
# $1 - name of product
|
237
|
+
# $2 - list of dependency products
|
238
|
+
define depend
|
239
|
+
$(call depend-build,$1,$2)
|
240
|
+
# depend output of this product on output of every specified product
|
241
|
+
$$($1_DESTINATION) : $(foreach dep,$2,$$($(dep)_DESTINATION))
|
242
|
+
endef
|
243
|
+
|
244
|
+
pkgconfig_pwd = perl -pi -e 's/(?<=dir=).*/$$ENV{PWD}/'
|
245
|
+
|
246
|
+
libtool_target_soname = perl -pi -e 's/(?<=soname_spec=)".*"/"$(@F)"/ ; s/(?<=library_names_spec=)".*"/"\\\$$libname\\\$$shared_ext"/' -- libtool
|
247
|
+
|
248
|
+
ifdef IS_DARWIN
|
249
|
+
chrpath_origin =
|
250
|
+
else ifdef IS_OPENBSD
|
251
|
+
chrpath_origin = perl -pi -e 's/XORIGIN/\$$ORIGIN/' -- $1
|
252
|
+
else
|
253
|
+
chrpath_origin = chrpath -r '$$ORIGIN' $1
|
254
|
+
endif
|
255
|
+
|
256
|
+
ifdef IS_LINUX
|
257
|
+
XORIGIN := -Wl,-rpath,XORIGIN
|
258
|
+
else ifdef IS_BSD
|
259
|
+
XORIGIN := -Wl,-rpath,XORIGIN -Wl,-z,origin
|
260
|
+
else
|
261
|
+
XORIGIN :=
|
262
|
+
endif
|
263
|
+
|
264
|
+
# ====== ENV ======
|
265
|
+
|
266
|
+
export CC := gcc
|
267
|
+
export CXX := g++
|
268
|
+
|
269
|
+
GCC_FLAGS := -O3
|
270
|
+
export CFLAGS = $(GCC_FLAGS)
|
271
|
+
export CXXFLAGS = $(GCC_FLAGS)
|
272
|
+
export CPPFLAGS = $(GCC_FLAGS)
|
273
|
+
export LDFLAGS = $(GCC_FLAGS)
|
274
|
+
|
275
|
+
ifdef IS_DARWIN
|
276
|
+
export MACOSX_DEPLOYMENT_TARGET := 10.6
|
277
|
+
GCC_FLAGS += -arch $(ARCH)
|
278
|
+
endif
|
279
|
+
|
280
|
+
ifdef IS_BSD
|
281
|
+
autotool_version = $(shell printf '%s\n' /usr/local/bin/$1-* | egrep -o '[0-9][^-]+$$' | tail -n 1)
|
282
|
+
export AUTOCONF_VERSION := $(call autotool_version,autoconf)
|
283
|
+
export AUTOMAKE_VERSION := $(call autotool_version,automake)
|
284
|
+
endif
|
285
|
+
|
286
|
+
# ====== BUILD TARGETS ======
|
287
|
+
|
288
|
+
## advpng
|
289
|
+
$(eval $(call depend,ADVPNG,LIBZ))
|
290
|
+
$(ADVPNG_TARGET) :
|
291
|
+
cd $(DIR) && ./configure LDFLAGS="$(XORIGIN)"
|
292
|
+
cd $(DIR) && $(MAKE) advpng
|
293
|
+
$(call chrpath_origin,$@)
|
294
|
+
|
295
|
+
## gifsicle
|
296
|
+
$(GIFSICLE_TARGET) :
|
297
|
+
cd $(DIR) && ./configure
|
298
|
+
cd $(DIR) && $(MAKE) gifsicle
|
299
|
+
|
300
|
+
## jhead
|
301
|
+
$(JHEAD_TARGET) :
|
302
|
+
cd $(DIR) && $(MAKE) jhead CC="$(CC) $(CFLAGS)"
|
303
|
+
|
304
|
+
## jpeg-recompress
|
305
|
+
$(eval $(call depend-build,JPEG-RECOMPRESS,LIBMOZJPEG))
|
306
|
+
$(JPEG-RECOMPRESS_TARGET) :
|
307
|
+
cd $(DIR) && $(MAKE) jpeg-recompress CC="$(CC) $(CFLAGS)" LIBJPEG=$(LIBMOZJPEG_TARGET) \
|
308
|
+
MAKE=$(MAKE) # fix for bsd in jpeg-archive-2.1.1
|
309
|
+
|
310
|
+
## jpegoptim
|
311
|
+
$(eval $(call depend,JPEGOPTIM,LIBJPEG))
|
312
|
+
$(JPEGOPTIM_TARGET) :
|
313
|
+
cd $(DIR) && ./configure LDFLAGS="$(XORIGIN)" --host $(HOST)
|
314
|
+
cd $(DIR) && $(MAKE) jpegoptim
|
315
|
+
$(call chrpath_origin,$@)
|
316
|
+
|
317
|
+
## jpegtran
|
318
|
+
$(eval $(call depend,JPEGTRAN,LIBJPEG))
|
319
|
+
$(JPEGTRAN_TARGET) :
|
320
|
+
cd $(DIR) && $(MAKE) jpegtran LDFLAGS="$(XORIGIN)"
|
321
|
+
$(call chrpath_origin,$(JPEGTRAN_TARGET))
|
322
|
+
|
323
|
+
## libjpeg
|
324
|
+
$(LIBJPEG_TARGET) :
|
325
|
+
cd $(DIR) && ./configure CC="$(CC) $(CFLAGS)"
|
326
|
+
cd $(DIR) && $(libtool_target_soname)
|
327
|
+
ifdef IS_DARWIN
|
328
|
+
cd $(DIR) && $(MAKE) libjpeg.la LDFLAGS="-Wl,-install_name,@loader_path/$(@F)"
|
329
|
+
else
|
330
|
+
cd $(DIR) && $(MAKE) libjpeg.la
|
331
|
+
endif
|
332
|
+
cd $(@D) && $(ln_s) .libs/libjpeg$(DLEXT) .
|
333
|
+
|
334
|
+
## libmozjpeg
|
335
|
+
$(LIBMOZJPEG_TARGET) :
|
336
|
+
cd $(DIR) && autoreconf -fiv
|
337
|
+
cd $(DIR) && ./configure --host $(HOST)
|
338
|
+
cd $(DIR)/simd && $(MAKE)
|
339
|
+
cd $(DIR) && $(MAKE) libjpeg.la
|
340
|
+
cd $(DIR) && $(ln_s) .libs/libjpeg.a .
|
341
|
+
|
342
|
+
## libpng
|
343
|
+
$(eval $(call depend,LIBPNG,LIBZ))
|
344
|
+
$(LIBPNG_TARGET) :
|
345
|
+
cd $(DIR) && ./configure CC="$(CC) $(CFLAGS)"
|
346
|
+
cd $(DIR) && $(pkgconfig_pwd) -- *.pc
|
347
|
+
cd $(DIR) && perl -pi -e 's/(?<=lpng)\d+//g' -- *.pc # %MAJOR%%MINOR% suffix
|
348
|
+
cd $(DIR) && $(libtool_target_soname)
|
349
|
+
ifdef IS_DARWIN
|
350
|
+
cd $(DIR) && $(MAKE) libpng16.la LDFLAGS="-Wl,-install_name,@loader_path/$(@F)"
|
351
|
+
else
|
352
|
+
cd $(DIR) && $(MAKE) libpng16.la LDFLAGS="$(XORIGIN)"
|
353
|
+
endif
|
354
|
+
cd $(DIR) && $(ln_s) .libs/libpng16$(DLEXT) libpng$(DLEXT)
|
355
|
+
$(call chrpath_origin,$@)
|
356
|
+
|
357
|
+
## libz
|
358
|
+
ifdef IS_DARWIN
|
359
|
+
$(LIBZ_TARGET) : export LDSHARED = $(CC) -dynamiclib -install_name @loader_path/$(@F) -compatibility_version 1 -current_version $(LIBZ_VER)
|
360
|
+
else
|
361
|
+
$(LIBZ_TARGET) : export LDSHARED = $(CC) -shared -Wl,-soname,$(@F),--version-script,zlib.map
|
362
|
+
endif
|
363
|
+
$(LIBZ_TARGET) :
|
364
|
+
cd $(DIR) && ./configure
|
365
|
+
cd $(DIR) && $(pkgconfig_pwd) -- *.pc
|
366
|
+
cd $(DIR) && $(MAKE) placebo
|
367
|
+
|
368
|
+
## optipng
|
369
|
+
$(eval $(call depend,OPTIPNG,LIBPNG LIBZ))
|
370
|
+
$(OPTIPNG_TARGET) :
|
371
|
+
cd $(DIR) && ./configure -with-system-libs
|
372
|
+
cd $(DIR) && $(MAKE) all LDFLAGS="$(XORIGIN) $(LDFLAGS)"
|
373
|
+
$(call chrpath_origin,$@)
|
374
|
+
|
375
|
+
## pngcrush
|
376
|
+
$(eval $(call depend,PNGCRUSH,LIBPNG LIBZ))
|
377
|
+
$(PNGCRUSH_TARGET) :
|
378
|
+
cd $(DIR) && rm -f png.h pngconf.h
|
379
|
+
cd $(DIR) && $(MAKE) pngcrush \
|
380
|
+
CC="$(CC)" \
|
381
|
+
LD="$(CC)" \
|
382
|
+
LIBS="-lpng -lz -lm" \
|
383
|
+
CFLAGS="$(CFLAGS)" \
|
384
|
+
CPPFLAGS="$(CPPFLAGS)" \
|
385
|
+
LDFLAGS="$(XORIGIN) $(LDFLAGS)"
|
386
|
+
$(call chrpath_origin,$@)
|
387
|
+
|
388
|
+
## pngquant
|
389
|
+
$(eval $(call depend,PNGQUANT,LIBPNG LIBZ))
|
390
|
+
$(PNGQUANT_TARGET) :
|
391
|
+
cd $(DIR) && ./configure --without-cocoa --extra-ldflags="$(XORIGIN)"
|
392
|
+
cd $(DIR) && $(MAKE) pngquant
|
393
|
+
$(call chrpath_origin,$@)
|
data/README.markdown
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
[](https://rubygems.org/gems/image_optim_pack)
|
2
|
+
[](https://travis-ci.org/toy/image_optim_pack)
|
3
|
+
[](https://codeclimate.com/github/toy/image_optim_pack)
|
4
|
+
[](https://gemnasium.com/toy/image_optim_pack)
|
5
|
+
[](https://inch-ci.org/github/toy/image_optim_pack)
|
6
|
+
|
7
|
+
# image\_optim\_pack
|
8
|
+
|
9
|
+
Precompiled binaries for [`image_optim`](https://github.com/toy/image_optim).
|
10
|
+
|
11
|
+
Contains binaries for Mac OS X (>= 10.6, i386 and x86\_64), Linux (i686 and x86\_64), FreeBSD (i386 and amd64) and OpenBSD (i386 and amd64).
|
12
|
+
|
13
|
+
## Binaries and libraries
|
14
|
+
|
15
|
+
* [advpng](http://www.advancemame.it/doc-advpng.html) by Andrea Mazzoleni and Filipe Estima ([GNU GPLv3](acknowledgements/advancecomp.txt))
|
16
|
+
* contains parts of [7z](http://7-zip.org) by Igor Pavlov with modifications by Andrea Mazzoleni ([license](acknowledgements/7z.txt))
|
17
|
+
* and [zopfli](https://code.google.com/p/zopfli/) by Lode Vandevenne and Jyrki Alakuijala ([license](acknowledgements/zopfli.txt), [contributors](acknowledgements/zopfli-contributors.txt))
|
18
|
+
* [gifsicle](http://lcdf.org/gifsicle/) by Eddie Kohler ([GNU GPLv2](acknowledgements/gifsicle.txt))
|
19
|
+
* [jhead](http://sentex.net/~mwandel/jhead/) by Matthias Wandel ([public domain](acknowledgements/jhead.txt))
|
20
|
+
* [jpeg-recompress](https://github.com/danielgtaylor/jpeg-archive) by Daniel G. Taylor ([license](acknowledgements/jpeg-archive.txt))
|
21
|
+
* includes [Image Quality Assessment (IQA)](http://tdistler.com/iqa/) by Tom Distler ([license](acknowledgements/iqa.txt))
|
22
|
+
* includes [SmallFry](https://github.com/dwbuiten/smallfry) by Derek Buitenhuis ([license](acknowledgements/smallfry.txt))
|
23
|
+
* statically linked against mozjpeg, see below
|
24
|
+
* [jpegoptim](http://www.kokkonen.net/tjko/projects.html) by Timo Kokkonen ([GNU GPLv2](acknowledgements/jpegoptim.txt) or later)
|
25
|
+
* [libjpeg and jpegtran](http://ijg.org/) by the Independent JPEG Group ([license](acknowledgements/libjpeg.txt))
|
26
|
+
* [libjpeg-turbo](http://www.libjpeg-turbo.org/) by libjpeg-turbo Project ([license](acknowledgements/libjpeg-turbo.txt))
|
27
|
+
* based on libjpeg, see above
|
28
|
+
* includes [x86 SIMD extension for IJG JPEG library](http://cetus.sakura.ne.jp/softlab/jpeg-x86simd/jpegsimd.html) by Miyasaka Masaru ([license](acknowledgements/libjpeg-x86-simd.txt))
|
29
|
+
* [libpng](http://libpng.org/pub/png/) by Guy Eric Schalnat, Andreas Dilger, Glenn Randers-Pehrson and others ([license](acknowledgements/libpng.txt))
|
30
|
+
* [mozjpeg](https://github.com/mozilla/mozjpeg) by Mozilla Research ([license](acknowledgements/mozjpeg.txt))
|
31
|
+
* base on libjpeg and libjpeg-turbo, see above
|
32
|
+
* [optipng](http://optipng.sourceforge.net/) by Cosmin Truta ([license](acknowledgements/optipng.txt), [authors](acknowledgements/optipng-authors.txt))
|
33
|
+
* contains code based in part on the work of Miyasaka Masaru for BMP support ([license](acknowledgements/bmp2png.txt))
|
34
|
+
* and David Koblas for GIF support ([license](acknowledgements/gifread.txt))
|
35
|
+
* [pngcrush](http://pmt.sourceforge.net/pngcrush/) by Glenn Randers-Pehrson, portions by Greg Roelofs ([license](acknowledgements/pngcrush.txt))
|
36
|
+
* contains [cexcept](http://www.nicemice.net/cexcept/) interface by Adam M. Costello and Cosmin Truta ([license](acknowledgements/cexcept.txt))
|
37
|
+
* [pngquant](http://pngquant.org/) by Kornel Lesiński based on code by Greg Roelofs and Jef Poskanzer after an idea by Stefan Schneider ([license](acknowledgements/pngquant.txt))
|
38
|
+
* [zlib](http://zlib.net/) by Jean-Loup Gailly and Mark Adler ([license](acknowledgements/zlib.txt))
|
39
|
+
|
40
|
+
**NOTE: On FreeBSD and OpenBSD `make` is not the GNU Make, so `gmake` should be used instead.**
|
41
|
+
|
42
|
+
You can download all source code using gnu make download target:
|
43
|
+
|
44
|
+
```sh
|
45
|
+
make download
|
46
|
+
```
|
47
|
+
|
48
|
+
## Installation
|
49
|
+
|
50
|
+
```sh
|
51
|
+
gem install image_optim image_optim_pack
|
52
|
+
```
|
53
|
+
|
54
|
+
Or add to your `Gemfile`:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
gem 'image_optim'
|
58
|
+
gem 'image_optim_pack'
|
59
|
+
```
|
60
|
+
|
61
|
+
## Development
|
62
|
+
|
63
|
+
Mac OS X binaries and libraries are built on host, others using [vagrant](https://www.vagrantup.com/).
|
64
|
+
|
65
|
+
Boxes for vagrant are built using [veewee](https://github.com/jedi4ever/veewee), check [boxes/Rakefile](boxes/Rakefile) and [boxes/definitions](boxes/definitions).
|
66
|
+
|
67
|
+
```sh
|
68
|
+
script/run # Build and test all for all oses and architectures
|
69
|
+
script/run NO_HALT=1 # Don't halt VMs after building
|
70
|
+
script/run NO_UP=1 # Don't start VMs before building (will fail if not already running)
|
71
|
+
script/run darwin 64 # Build only platforms matching darwin or 64
|
72
|
+
|
73
|
+
make # Build all tools and copy them to vendor/OS-ARCH for current OS and ARCH, then test
|
74
|
+
make all # same
|
75
|
+
|
76
|
+
make livecheck # Check versions
|
77
|
+
make update-versions # Update versions in Makefile
|
78
|
+
|
79
|
+
make download # Download archives
|
80
|
+
make download-tidy-up # Remove old archives
|
81
|
+
make build # Build all without copying to output directory
|
82
|
+
|
83
|
+
make test # Test bins for current os/arch
|
84
|
+
make test -i # Continue if one of bins fail
|
85
|
+
|
86
|
+
make clean # Remove build and output directories for current os/arch
|
87
|
+
make clean-all # Remove build root and output root directories
|
88
|
+
make clobber # `clean-all` and remove download directory
|
89
|
+
```
|
90
|
+
|
91
|
+
## Copyright
|
92
|
+
|
93
|
+
Copyright (c) 2014-2017 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
|
data/Vagrantfile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
Vagrant.require_version '!= 1.8.5' # OpenBSD can't be halted in 1.8.5
|
2
|
+
|
3
|
+
Vagrant.configure('2') do |config|
|
4
|
+
# don't mess with keys
|
5
|
+
config.ssh.insert_key = false
|
6
|
+
|
7
|
+
# doesn't make sense to check updates for local boxes
|
8
|
+
config.vm.box_check_update = false
|
9
|
+
|
10
|
+
# there are no guest additions
|
11
|
+
config.vm.provider 'virtualbox' do |vb|
|
12
|
+
vb.check_guest_additions = false
|
13
|
+
vb.customize ['modifyvm', :id, '--groups', '/image_optim']
|
14
|
+
end
|
15
|
+
|
16
|
+
# handle manually using rsync
|
17
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
18
|
+
|
19
|
+
{
|
20
|
+
'linux-x86_64' => 'ubuntu/trusty64',
|
21
|
+
'linux-i686' => 'ubuntu/trusty32',
|
22
|
+
'freebsd-amd64' => 'boxes/freebsd-amd64.box',
|
23
|
+
'freebsd-i386' => 'boxes/freebsd-i386.box',
|
24
|
+
'openbsd-amd64' => 'boxes/openbsd-amd64.box',
|
25
|
+
'openbsd-i386' => 'boxes/openbsd-i386.box',
|
26
|
+
}.each do |name, location|
|
27
|
+
config.vm.define name do |machine|
|
28
|
+
machine.vm.hostname = name.gsub('_', '-')
|
29
|
+
machine.vm.box = location
|
30
|
+
|
31
|
+
machine.vm.provision :shell, inline: case name
|
32
|
+
when /^linux/
|
33
|
+
<<-SH
|
34
|
+
set -ex
|
35
|
+
apt-get -y install rsync ntpdate make wget gcc g++ chrpath perl pkg-config autoconf automake libtool nasm
|
36
|
+
SH
|
37
|
+
when /^freebsd/
|
38
|
+
<<-SH
|
39
|
+
set -ex
|
40
|
+
pkg install -y rsync gmake wget gcc chrpath perl5 pkgconf autoconf automake libtool nasm
|
41
|
+
SH
|
42
|
+
when /^openbsd/
|
43
|
+
<<-SH
|
44
|
+
set -ex
|
45
|
+
pkg_add -z rsync-- ntp gmake gtar-- wget g++-4.8.2p2 autoconf-2.69 automake-1.14.1 libtool nasm
|
46
|
+
path=/home/vagrant/shared
|
47
|
+
mkdir -p $path
|
48
|
+
chown vagrant:vagrant $path
|
49
|
+
ln -nfs $path /vagrant
|
50
|
+
SH
|
51
|
+
end
|
52
|
+
|
53
|
+
machine.vm.provision :shell, inline: <<-SH
|
54
|
+
set -ex
|
55
|
+
mkdir -p /vagrant
|
56
|
+
chown vagrant:vagrant /vagrant
|
57
|
+
SH
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
7-Zip
|
2
|
+
~~~~~
|
3
|
+
License for use and distribution
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
7-Zip Copyright (C) 1999-2014 Igor Pavlov.
|
7
|
+
|
8
|
+
Licenses for files are:
|
9
|
+
|
10
|
+
1) 7z.dll: GNU LGPL + unRAR restriction
|
11
|
+
2) All other files: GNU LGPL
|
12
|
+
|
13
|
+
The GNU LGPL + unRAR restriction means that you must follow both
|
14
|
+
GNU LGPL rules and unRAR restriction rules.
|
15
|
+
|
16
|
+
|
17
|
+
Note:
|
18
|
+
You can use 7-Zip on any computer, including a computer in a commercial
|
19
|
+
organization. You don't need to register or pay for 7-Zip.
|
20
|
+
|
21
|
+
|
22
|
+
GNU LGPL information
|
23
|
+
--------------------
|
24
|
+
|
25
|
+
This library is free software; you can redistribute it and/or
|
26
|
+
modify it under the terms of the GNU Lesser General Public
|
27
|
+
License as published by the Free Software Foundation; either
|
28
|
+
version 2.1 of the License, or (at your option) any later version.
|
29
|
+
|
30
|
+
This library is distributed in the hope that it will be useful,
|
31
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
32
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
33
|
+
Lesser General Public License for more details.
|
34
|
+
|
35
|
+
You can receive a copy of the GNU Lesser General Public License from
|
36
|
+
http://www.gnu.org/
|
37
|
+
|
38
|
+
|
39
|
+
unRAR restriction
|
40
|
+
-----------------
|
41
|
+
|
42
|
+
The decompression engine for RAR archives was developed using source
|
43
|
+
code of unRAR program.
|
44
|
+
All copyrights to original unRAR code are owned by Alexander Roshal.
|
45
|
+
|
46
|
+
The license for original unRAR code has the following restriction:
|
47
|
+
|
48
|
+
The unRAR sources cannot be used to re-create the RAR compression algorithm,
|
49
|
+
which is proprietary. Distribution of modified unRAR sources in separate form
|
50
|
+
or as a part of other software is permitted, provided that it is clearly
|
51
|
+
stated in the documentation and source comments that the code may
|
52
|
+
not be used to develop a RAR (WinRAR) compatible archiver.
|
53
|
+
|
54
|
+
|
55
|
+
--
|
56
|
+
Igor Pavlov
|