image_optim_pack 0.2.3 → 0.3.0
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 +8 -8
- data/.gitignore +1 -1
- data/.rubocop.yml +3 -0
- data/.travis.yml +12 -9
- data/Makefile +39 -12
- data/README.markdown +14 -9
- data/Vagrantfile +45 -7
- data/boxes/.gitignore +3 -0
- data/boxes/.rubocop.yml +10 -0
- data/boxes/Gemfile +6 -0
- data/boxes/Rakefile +143 -0
- data/boxes/definitions/centos-amd64/definition.rb +30 -0
- data/boxes/definitions/centos-amd64/ks.cfg +37 -0
- data/boxes/definitions/centos-i386/definition.rb +30 -0
- data/boxes/definitions/centos-i386/ks.cfg +37 -0
- data/boxes/definitions/centos-postinstall.sh +33 -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.gemspec +2 -4
- data/lib/image_optim/pack.rb +2 -3
- data/script/livecheck +29 -2
- data/script/run +32 -6
- data/script/update_versions +2 -0
- data/spec/image_optim/pack_spec.rb +2 -2
- data/vendor/{darwin/i386 → darwin-i386}/advpng +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/gifsicle +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/jhead +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/jpeg-recompress +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/jpegoptim +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/jpegtran +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/libjpeg.dylib +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/libpng.dylib +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/libz.dylib +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/optipng +0 -0
- data/vendor/darwin-i386/pngcrush +0 -0
- data/vendor/{darwin/i386 → darwin-i386}/pngquant +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/advpng +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/gifsicle +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/jhead +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/jpeg-recompress +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegoptim +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegtran +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/libjpeg.dylib +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/libpng.dylib +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/libz.dylib +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/optipng +0 -0
- data/vendor/darwin-x86_64/pngcrush +0 -0
- data/vendor/{darwin/x86_64 → darwin-x86_64}/pngquant +0 -0
- data/vendor/freebsd-amd64/advpng +0 -0
- data/vendor/freebsd-amd64/gifsicle +0 -0
- data/vendor/freebsd-amd64/jhead +0 -0
- data/vendor/freebsd-amd64/jpeg-recompress +0 -0
- data/vendor/freebsd-amd64/jpegoptim +0 -0
- data/vendor/freebsd-amd64/jpegtran +0 -0
- data/vendor/freebsd-amd64/libjpeg.so +0 -0
- data/vendor/freebsd-amd64/libpng.so +0 -0
- data/vendor/freebsd-amd64/libz.so +0 -0
- data/vendor/freebsd-amd64/optipng +0 -0
- data/vendor/freebsd-amd64/pngcrush +0 -0
- data/vendor/freebsd-amd64/pngquant +0 -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
- data/vendor/{linux/i686 → linux-i686}/advpng +0 -0
- data/vendor/{linux/i686 → linux-i686}/gifsicle +0 -0
- data/vendor/{linux/i686 → linux-i686}/jhead +0 -0
- data/vendor/{linux/i686 → linux-i686}/jpeg-recompress +0 -0
- data/vendor/{linux/i686 → linux-i686}/jpegoptim +0 -0
- data/vendor/{linux/i686 → linux-i686}/jpegtran +0 -0
- data/vendor/{linux/i686 → linux-i686}/libjpeg.so +0 -0
- data/vendor/{linux/i686 → linux-i686}/libpng.so +0 -0
- data/vendor/{linux/i686 → linux-i686}/libz.so +0 -0
- data/vendor/{linux/i686 → linux-i686}/optipng +0 -0
- data/vendor/linux-i686/pngcrush +0 -0
- data/vendor/{linux/i686 → linux-i686}/pngquant +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/advpng +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/gifsicle +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/jhead +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/jpeg-recompress +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/jpegoptim +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/jpegtran +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/libjpeg.so +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/libpng.so +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/libz.so +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/optipng +0 -0
- data/vendor/linux-x86_64/pngcrush +0 -0
- data/vendor/{linux/x86_64 → linux-x86_64}/pngquant +0 -0
- data/vendor/openbsd-amd64/advpng +0 -0
- data/vendor/openbsd-amd64/gifsicle +0 -0
- data/vendor/openbsd-amd64/jhead +0 -0
- data/vendor/openbsd-amd64/jpeg-recompress +0 -0
- data/vendor/openbsd-amd64/jpegoptim +0 -0
- data/vendor/openbsd-amd64/jpegtran +0 -0
- data/vendor/openbsd-amd64/libjpeg.so +0 -0
- data/vendor/openbsd-amd64/libpng.so +0 -0
- data/vendor/openbsd-amd64/libz.so +0 -0
- data/vendor/openbsd-amd64/optipng +0 -0
- data/vendor/openbsd-amd64/pngcrush +0 -0
- data/vendor/openbsd-amd64/pngquant +0 -0
- data/vendor/openbsd-i386/advpng +0 -0
- data/vendor/openbsd-i386/gifsicle +0 -0
- data/vendor/openbsd-i386/jhead +0 -0
- data/vendor/openbsd-i386/jpeg-recompress +0 -0
- data/vendor/openbsd-i386/jpegoptim +0 -0
- data/vendor/openbsd-i386/jpegtran +0 -0
- data/vendor/openbsd-i386/libjpeg.so +0 -0
- data/vendor/openbsd-i386/libpng.so +0 -0
- data/vendor/openbsd-i386/libz.so +0 -0
- data/vendor/openbsd-i386/optipng +0 -0
- data/vendor/openbsd-i386/pngcrush +0 -0
- data/vendor/openbsd-i386/pngquant +0 -0
- metadata +115 -93
- data/script/vm_init +0 -30
- data/vendor/darwin/i386/pngcrush +0 -0
- data/vendor/darwin/x86_64/pngcrush +0 -0
- data/vendor/linux/i686/pngcrush +0 -0
- data/vendor/linux/x86_64/pngcrush +0 -0
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
NDJlODk4ZjgyOGU3ODVmMTMxYzFhN2VmNDBiYzU5ZGFkMmJjMDg4Nw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
Yjk1NzE3MzdkZDJhM2RhYTBkNTFlNjgzYzhhNjI5YzEzMDk0ODFlMQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MjAxMTI2ZTY3MDEyMzFmZmQ4ODI4MGMyZTczN2Y5YWZiOTkyYzAxZmFmN2Y4
|
|
10
|
+
NzgyMjZjYzBhYTJjYTY5OTQ5Y2Y5MmQzNTIxZWYxNTNhMWQwNzIzYjA3MzEy
|
|
11
|
+
ZWM5OTk5NTczYTNmMjVhYzMzZDZiMWEyNTM3YWEwZGU1NGQxNWY=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NDQzODVkODljZTQ0YWRhNDMzYzE1ZDgyNTVmYTg2YzAxNmM5Yzc5MmJjZjA1
|
|
14
|
+
ZTI5YWM1ZjFjNTk1MjQ0NTNkMjg3M2I5MjE0MjNlYWU0YTUyYjZiNDdhMjJi
|
|
15
|
+
YTEzNzg3OTY3OGY2ODUyYjE5MWNhMWVlYzA5N2Q3MmY0MmZjNTk=
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
|
@@ -9,14 +9,17 @@ rvm:
|
|
|
9
9
|
- jruby-18mode
|
|
10
10
|
- jruby-19mode
|
|
11
11
|
- ree
|
|
12
|
-
script:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
script: |
|
|
13
|
+
(
|
|
14
|
+
set -ex
|
|
15
|
+
if [ -n "$RUBOCOP" ]; then
|
|
16
|
+
bundle exec rubocop
|
|
17
|
+
else
|
|
18
|
+
make test
|
|
19
|
+
bundle exec image_optim --info
|
|
20
|
+
bundle exec rspec
|
|
21
|
+
fi
|
|
22
|
+
)
|
|
20
23
|
before_install:
|
|
21
24
|
if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install imagemagick; fi
|
|
22
25
|
matrix:
|
|
@@ -25,4 +28,4 @@ matrix:
|
|
|
25
28
|
- os: osx
|
|
26
29
|
rvm: default
|
|
27
30
|
- env: RUBOCOP=true
|
|
28
|
-
rvm:
|
|
31
|
+
rvm: '2'
|
data/Makefile
CHANGED
|
@@ -12,7 +12,7 @@ LIBMOZJPEG_VER := 3.1
|
|
|
12
12
|
LIBPNG_VER := 1.6.23
|
|
13
13
|
LIBZ_VER := 1.2.8
|
|
14
14
|
OPTIPNG_VER := 0.7.6
|
|
15
|
-
PNGCRUSH_VER := 1.8.
|
|
15
|
+
PNGCRUSH_VER := 1.8.2
|
|
16
16
|
PNGQUANT_VER := 2.7.1
|
|
17
17
|
|
|
18
18
|
# ====== CONSTANTS ======
|
|
@@ -21,14 +21,18 @@ OS := $(shell uname -s | tr A-Z a-z)
|
|
|
21
21
|
ARCH := $(shell uname -m)
|
|
22
22
|
|
|
23
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))
|
|
24
28
|
DLEXT := $(if $(IS_DARWIN),.dylib,.so)
|
|
25
29
|
HOST := $(ARCH)-$(if $(IS_DARWIN),apple,pc)-$(OS)
|
|
26
30
|
|
|
27
31
|
DL_DIR := $(CURDIR)/download
|
|
28
32
|
BUILD_ROOT_DIR := $(CURDIR)/build
|
|
29
|
-
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)
|
|
33
|
+
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)-$(ARCH)
|
|
30
34
|
OUTPUT_ROOT_DIR := $(CURDIR)/vendor
|
|
31
|
-
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)
|
|
35
|
+
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)-$(ARCH)
|
|
32
36
|
|
|
33
37
|
# ====== HELPERS ======
|
|
34
38
|
|
|
@@ -36,6 +40,7 @@ downcase = $(shell echo $1 | tr A-Z a-z)
|
|
|
36
40
|
|
|
37
41
|
mkpath := mkdir -p
|
|
38
42
|
ln_s := ln -sf
|
|
43
|
+
tar := $(shell if command -v gtar >/dev/null 2>&1; then echo gtar; else echo tar; fi)
|
|
39
44
|
|
|
40
45
|
# lock using %.lock dir, download to %.tmp rename to %, remove %.lock
|
|
41
46
|
define download
|
|
@@ -105,7 +110,10 @@ $(call target-build,$1,$2,$3)
|
|
|
105
110
|
PRODUCTS += $1
|
|
106
111
|
# copy product to output dir
|
|
107
112
|
$$(OUTPUT_DIR)/$$($1_BASENAME) : $$($1_TARGET)
|
|
108
|
-
|
|
113
|
+
temppath=`mktemp tmp.XXXXXXXXXX` && \
|
|
114
|
+
strip $$< -Sx -o "$$$$temppath" && \
|
|
115
|
+
chmod 755 "$$$$temppath" && \
|
|
116
|
+
mv "$$$$temppath" $$@
|
|
109
117
|
# short name target
|
|
110
118
|
$(call downcase,$1) : | $$(OUTPUT_DIR)/$$($1_BASENAME)
|
|
111
119
|
endef
|
|
@@ -136,6 +144,7 @@ download-tidy-up :
|
|
|
136
144
|
build : $(foreach product,$(PRODUCTS),$($(product)_TARGET))
|
|
137
145
|
|
|
138
146
|
define check_bin
|
|
147
|
+
@printf "$1: "
|
|
139
148
|
@test -f $(OUTPUT_DIR)/$1 || (echo "no $1"; false)
|
|
140
149
|
@# if bin exists check architecture
|
|
141
150
|
@test ! -f $(OUTPUT_DIR)/$1 || \
|
|
@@ -143,15 +152,15 @@ define check_bin
|
|
|
143
152
|
(echo "Expected $(ARCH_STRING), got $$(file -b $(OUTPUT_DIR)/$1)"; false)
|
|
144
153
|
@# if bin exists check and output version
|
|
145
154
|
@test ! -f $(OUTPUT_DIR)/$1 || \
|
|
146
|
-
$(OUTPUT_DIR)/$1 $2 | fgrep
|
|
155
|
+
$(OUTPUT_DIR)/$1 $2 | fgrep -o $3 || \
|
|
147
156
|
(echo "Expected $3, got $$($(OUTPUT_DIR)/$1 $2)"; false)
|
|
148
157
|
endef
|
|
149
158
|
|
|
150
159
|
ifdef IS_DARWIN
|
|
151
160
|
test : ARCH_STRING := $(ARCH)
|
|
152
|
-
else ifeq (
|
|
161
|
+
else ifeq (i386,$(ARCH:i686=i386))
|
|
153
162
|
test : ARCH_STRING := Intel 80386
|
|
154
|
-
else ifeq (
|
|
163
|
+
else ifeq (amd64,$(ARCH:x86_64=amd64))
|
|
155
164
|
test : ARCH_STRING := x86-64
|
|
156
165
|
endif
|
|
157
166
|
test :
|
|
@@ -209,18 +218,29 @@ endef
|
|
|
209
218
|
define clean_untar
|
|
210
219
|
rm -rf $(@D)
|
|
211
220
|
$(mkpath) $(@D)
|
|
212
|
-
tar -C $(@D) --strip-components=1 -
|
|
221
|
+
$(tar) -C $(@D) --strip-components=1 -xzf $<
|
|
213
222
|
touch $(@D)/__$(notdir $<)__
|
|
214
223
|
endef
|
|
215
224
|
|
|
216
225
|
pkgconfig_pwd = perl -pi -e 's/(?<=dir=).*/$$ENV{PWD}/'
|
|
217
226
|
|
|
218
|
-
libtool_target_soname = cd $(@D) && perl -pi -e 's/(?<=soname_spec=)".*"/"$(@F)"/' -- libtool
|
|
227
|
+
libtool_target_soname = cd $(@D) && perl -pi -e 's/(?<=soname_spec=)".*"/"$(@F)"/ ; s/(?<=library_names_spec=)".*"/"\\\$$libname\\\$$shared_ext"/' -- libtool
|
|
219
228
|
|
|
220
|
-
|
|
229
|
+
ifdef IS_DARWIN
|
|
230
|
+
chrpath_origin =
|
|
231
|
+
else ifdef IS_OPENBSD
|
|
232
|
+
chrpath_origin = perl -pi -e 's/XORIGIN/\$$ORIGIN/' -- $1
|
|
233
|
+
else
|
|
234
|
+
chrpath_origin = chrpath -r '$$ORIGIN' $1
|
|
235
|
+
endif
|
|
221
236
|
|
|
237
|
+
ifdef IS_LINUX
|
|
222
238
|
XORIGIN := -Wl,-rpath,XORIGIN
|
|
223
|
-
|
|
239
|
+
else ifdef IS_BSD
|
|
240
|
+
XORIGIN := -Wl,-rpath,XORIGIN -Wl,-z,origin
|
|
241
|
+
else
|
|
242
|
+
XORIGIN :=
|
|
243
|
+
endif
|
|
224
244
|
|
|
225
245
|
export CC = gcc
|
|
226
246
|
export CXX = g++
|
|
@@ -240,6 +260,12 @@ ifdef IS_DARWIN
|
|
|
240
260
|
export MACOSX_DEPLOYMENT_TARGET=10.6
|
|
241
261
|
endif
|
|
242
262
|
|
|
263
|
+
ifdef IS_BSD
|
|
264
|
+
autotool_version = $(shell printf '%s\n' /usr/local/bin/$1-* | egrep -o '[0-9][^-]+$$' | tail -n 1)
|
|
265
|
+
export AUTOCONF_VERSION := $(call autotool_version,autoconf)
|
|
266
|
+
export AUTOMAKE_VERSION := $(call autotool_version,automake)
|
|
267
|
+
endif
|
|
268
|
+
|
|
243
269
|
## advpng
|
|
244
270
|
$(eval $(call depend,ADVPNG,LIBZ))
|
|
245
271
|
$(ADVPNG_TARGET) :; $(clean_untar)
|
|
@@ -260,7 +286,8 @@ $(JHEAD_TARGET) :; $(clean_untar)
|
|
|
260
286
|
## jpeg-recompress
|
|
261
287
|
$(eval $(call depend-build,JPEG-RECOMPRESS,LIBMOZJPEG))
|
|
262
288
|
$(JPEG-RECOMPRESS_TARGET) :; $(clean_untar)
|
|
263
|
-
cd $(@D) && $(MAKE) jpeg-recompress CC="$(CC) $(GCC_FLAGS)" LIBJPEG=$(LIBMOZJPEG_TARGET)
|
|
289
|
+
cd $(@D) && $(MAKE) jpeg-recompress CC="$(CC) $(GCC_FLAGS)" LIBJPEG=$(LIBMOZJPEG_TARGET) \
|
|
290
|
+
MAKE=$(MAKE) # fix for bsd in jpeg-archive-2.1.1
|
|
264
291
|
|
|
265
292
|
## jpegoptim
|
|
266
293
|
$(eval $(call depend,JPEGOPTIM,LIBJPEG))
|
data/README.markdown
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Precompiled binaries for [`image_optim`](https://github.com/toy/image_optim).
|
|
10
10
|
|
|
11
|
-
Contains binaries for Mac OS X (>= 10.6, i386 and x86\_64)
|
|
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
12
|
|
|
13
13
|
## Binaries and libraries
|
|
14
14
|
|
|
@@ -37,6 +37,8 @@ Contains binaries for Mac OS X (>= 10.6, i386 and x86\_64) and Linux (i686 and x
|
|
|
37
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
38
|
* [zlib](http://zlib.net/) by Jean-Loup Gailly and Mark Adler ([license](acknowledgements/zlib.txt))
|
|
39
39
|
|
|
40
|
+
**NOTE: On FreeBSD and OpenBSD `make` is not the GNU Make, so `gmake` should be used instead.**
|
|
41
|
+
|
|
40
42
|
You can download all source code using gnu make download target:
|
|
41
43
|
|
|
42
44
|
```sh
|
|
@@ -58,27 +60,30 @@ gem 'image_optim_pack'
|
|
|
58
60
|
|
|
59
61
|
## Development
|
|
60
62
|
|
|
61
|
-
Mac OS X binaries and libraries are built on host, others using vagrant.
|
|
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).
|
|
62
66
|
|
|
63
67
|
```sh
|
|
64
68
|
script/run # Build and test all for all oses and architectures
|
|
65
69
|
script/run NO_HALT=1 # Don't halt VMs after building
|
|
66
70
|
|
|
67
|
-
make
|
|
68
|
-
make
|
|
71
|
+
make # Build all tools and copy them to vendor/OS-ARCH for current OS and ARCH, then test
|
|
72
|
+
make all # same
|
|
73
|
+
make run # same
|
|
69
74
|
|
|
70
|
-
make
|
|
71
|
-
make
|
|
75
|
+
make livecheck # Check versions
|
|
76
|
+
make update-versions # Update versions in Makefile
|
|
72
77
|
|
|
73
78
|
make download # Download archives
|
|
74
79
|
make build # Build all without copying to output directory
|
|
75
80
|
|
|
76
|
-
make
|
|
77
|
-
make
|
|
81
|
+
make test # Test bins for current os/arch
|
|
82
|
+
make test -i # Continue if one of bins fail
|
|
78
83
|
|
|
79
84
|
make clean # Remove build and output directories for current os/arch
|
|
80
85
|
make clean-all # Remove build root and output root directories
|
|
81
|
-
make clobber # `
|
|
86
|
+
make clobber # `clean-all` and remove download directory
|
|
82
87
|
```
|
|
83
88
|
|
|
84
89
|
## Copyright
|
data/Vagrantfile
CHANGED
|
@@ -1,13 +1,51 @@
|
|
|
1
|
+
Vagrant.require_version '!= 1.8.5' # OpenBSD can't be halted in 1.8.5
|
|
2
|
+
|
|
1
3
|
Vagrant.configure('2') do |config|
|
|
4
|
+
# don't mess with keys
|
|
5
|
+
config.ssh.insert_key = false
|
|
6
|
+
|
|
7
|
+
# handle manually using rsync
|
|
8
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
|
9
|
+
|
|
2
10
|
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
'linux-x86_64' => 'boxes/centos-amd64.box',
|
|
12
|
+
'linux-i686' => 'boxes/centos-i386.box',
|
|
13
|
+
'freebsd-amd64' => 'boxes/freebsd-amd64.box',
|
|
14
|
+
'freebsd-i386' => 'boxes/freebsd-i386.box',
|
|
15
|
+
'openbsd-amd64' => 'boxes/openbsd-amd64.box',
|
|
16
|
+
'openbsd-i386' => 'boxes/openbsd-i386.box',
|
|
17
|
+
}.each do |name, location|
|
|
6
18
|
config.vm.define name do |machine|
|
|
7
|
-
machine.vm.hostname = name.
|
|
8
|
-
machine.vm.box =
|
|
19
|
+
machine.vm.hostname = name.gsub('_', '-')
|
|
20
|
+
machine.vm.box = location
|
|
21
|
+
|
|
22
|
+
machine.vm.provision :shell, inline: case name
|
|
23
|
+
when /^linux/
|
|
24
|
+
<<-SH
|
|
25
|
+
set -ex
|
|
26
|
+
yum -y install rsync ntpdate make wget gcc gcc-c++ chrpath perl pkg-config autoconf automake libtool nasm
|
|
27
|
+
SH
|
|
28
|
+
when /^freebsd/
|
|
29
|
+
<<-SH
|
|
30
|
+
set -ex
|
|
31
|
+
pkg install -y rsync ntp gmake wget gcc chrpath perl5 pkgconf autoconf automake libtool nasm
|
|
32
|
+
SH
|
|
33
|
+
when /^openbsd/
|
|
34
|
+
<<-SH
|
|
35
|
+
set -ex
|
|
36
|
+
pkg_add -z rsync-- ntp gmake gtar-- wget gcc-4.8.2p2 autoconf-2.69 automake-1.14.1 libtool nasm
|
|
37
|
+
path=/home/vagrant/shared
|
|
38
|
+
mkdir -p $path
|
|
39
|
+
chown vagrant:vagrant $path
|
|
40
|
+
ln -nfs $path /vagrant
|
|
41
|
+
SH
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
machine.vm.provision :shell, inline: <<-SH
|
|
45
|
+
set -ex
|
|
46
|
+
mkdir -p /vagrant
|
|
47
|
+
chown vagrant:vagrant /vagrant
|
|
48
|
+
SH
|
|
9
49
|
end
|
|
10
50
|
end
|
|
11
|
-
|
|
12
|
-
config.vm.provision :shell, path: 'script/vm_init'
|
|
13
51
|
end
|
data/boxes/.gitignore
ADDED
data/boxes/.rubocop.yml
ADDED
data/boxes/Gemfile
ADDED
data/boxes/Rakefile
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
require 'atlas'
|
|
2
|
+
require 'dotenv/tasks'
|
|
3
|
+
require 'pathname'
|
|
4
|
+
require 'progress'
|
|
5
|
+
|
|
6
|
+
# Show progress when file is read by excon used by atlas
|
|
7
|
+
class BodyProgress # :nodoc:
|
|
8
|
+
def initialize(path, &block)
|
|
9
|
+
fail ArgumentError, 'block required' unless block
|
|
10
|
+
@io = File.open(path)
|
|
11
|
+
Progress.start(path, File.size(path)) do
|
|
12
|
+
yield self
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def size
|
|
17
|
+
@io.size
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def read(length)
|
|
21
|
+
data = @io.read(length)
|
|
22
|
+
Progress.step data.length if data
|
|
23
|
+
data
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class Box # :nodoc:
|
|
28
|
+
attr_reader :definition_path, :definition_dir, :name, :path
|
|
29
|
+
|
|
30
|
+
def initialize(definition_path)
|
|
31
|
+
@definition_path = Pathname(definition_path)
|
|
32
|
+
@definition_dir = @definition_path.dirname
|
|
33
|
+
@name = @definition_dir.basename.to_s
|
|
34
|
+
@path = Pathname("#{@name}.box")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def dependencies
|
|
38
|
+
[definition_path] + Array(definition[:postinstall_files]).map do |path|
|
|
39
|
+
definition_dir + path
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def build
|
|
44
|
+
sh(*%W[veewee vbox build --auto --checksum --force --nogui #{name}])
|
|
45
|
+
sh(*%w[sleep 30])
|
|
46
|
+
sh(*%W[veewee vbox export --force #{name}])
|
|
47
|
+
sh(*%W[veewee vbox destroy #{name}])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def add
|
|
51
|
+
assert_box_created
|
|
52
|
+
|
|
53
|
+
sh(*%W[vagrant box add --force --name boxes/#{path} #{path}])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def upload(version)
|
|
57
|
+
assert_box_created
|
|
58
|
+
|
|
59
|
+
box = Atlas::Box.create({
|
|
60
|
+
:username => 'image_optim_pack',
|
|
61
|
+
:name => name,
|
|
62
|
+
:short_description => "minimal #{name} (bash, wget) from #{definition[:iso_file]}",
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
version = box.create_version(:version => version)
|
|
66
|
+
|
|
67
|
+
provider = version.create_provider(:name => 'virtualbox')
|
|
68
|
+
|
|
69
|
+
BodyProgress.new(path) do |f|
|
|
70
|
+
provider.upload(f)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
version.release
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def definition
|
|
79
|
+
@definition ||= begin
|
|
80
|
+
eval definition_path.read.sub('Veewee::Session.declare', '{}.merge')
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def assert_box_created
|
|
85
|
+
abort "#{path} doesn't exist" unless path.size?
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def sh(*args)
|
|
89
|
+
abort unless system(*args)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
task :atlas => :dotenv do
|
|
94
|
+
token = ENV['ATLAS_TOKEN'].to_s
|
|
95
|
+
fail 'ATLAS_TOKEN missing' if token.empty?
|
|
96
|
+
Atlas.configure do |config|
|
|
97
|
+
config.access_token = token
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
desc 'build all boxes'
|
|
102
|
+
task :build
|
|
103
|
+
|
|
104
|
+
desc 'add all boxes to vagrant'
|
|
105
|
+
task :add
|
|
106
|
+
|
|
107
|
+
desc 'upload all boxes to atlas'
|
|
108
|
+
task :upload
|
|
109
|
+
|
|
110
|
+
version = Time.now.strftime('%Y%m%d.0.0')
|
|
111
|
+
Dir['definitions/*/definition.rb'].each do |definition_path|
|
|
112
|
+
box = Box.new(definition_path)
|
|
113
|
+
|
|
114
|
+
desc "build #{box.path}"
|
|
115
|
+
file box.path => box.dependencies do
|
|
116
|
+
box.build
|
|
117
|
+
end
|
|
118
|
+
task :build => box.path
|
|
119
|
+
|
|
120
|
+
namespace :add do
|
|
121
|
+
desc "add #{box.path}"
|
|
122
|
+
task box.name => box.path do
|
|
123
|
+
box.add
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
task :add => "add:#{box.name}"
|
|
127
|
+
|
|
128
|
+
namespace :upload do
|
|
129
|
+
desc "upload #{box.path}"
|
|
130
|
+
task box.name => [:atlas, box.path] do
|
|
131
|
+
box.upload(version)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
task :upload => "upload:#{box.name}"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
desc 'remove *.box and iso dir'
|
|
138
|
+
task :clean do
|
|
139
|
+
sh 'rm *.box || true'
|
|
140
|
+
sh 'rm -r iso || true'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
task :default => :build
|