emf2svg 1.3.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +178 -0
- data/.github/workflows/release.yml +66 -61
- data/.rubocop.yml +1 -1
- data/README.adoc +132 -47
- data/Rakefile +1 -0
- data/bin/emf2svg +33 -3
- data/emf2svg.gemspec +2 -2
- data/exe/emf2svg +33 -2
- data/lib/emf2svg/recipe.rb +108 -65
- data/lib/emf2svg/version.rb +2 -1
- data/lib/emf2svg.rb +8 -7
- metadata +5 -5
- data/.github/workflows/main.yml +0 -167
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 182ec714bf4b4ce50317e1993bc7cd6226f4c607b490a4aae7fc858e8f7efa5d
|
4
|
+
data.tar.gz: 121b3a9ddf5d32765d3cbd97da44902e273e1806725cc2a1c083d71697fb1160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55381784014d5897748891fa64e0f38e8ef448f76eb30517538635959ebc045c4e39a385463a76147538191ca7f476689330dea2800b14388c29cb8239f56361
|
7
|
+
data.tar.gz: 18eb6f5c1a77e2c170f27e8fd1dc52169c15f986e2c7ad52f256d18875d01eec434adf423a06a7c538151e52cfb2fad00a42486d4c1be19984a520a992708ccc
|
@@ -0,0 +1,178 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
paths-ignore:
|
7
|
+
- '*.adoc'
|
8
|
+
pull_request:
|
9
|
+
workflow_dispatch:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ${{ matrix.os }}
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
18
|
+
ruby-version: [ '2.7', '3.0', '3.1' ]
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v3
|
22
|
+
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
bundler-cache: true
|
26
|
+
ruby-version: ${{ matrix.ruby-version }}
|
27
|
+
|
28
|
+
# https://github.com/microsoft/vcpkg/issues/15931
|
29
|
+
# no good solution :(
|
30
|
+
- name: Workaround for vcpkg
|
31
|
+
if: startsWith(matrix.os, 'ubuntu')
|
32
|
+
run: |
|
33
|
+
sudo apt-get update
|
34
|
+
sudo apt-get install gperf
|
35
|
+
|
36
|
+
- run: bundle exec rake
|
37
|
+
|
38
|
+
build:
|
39
|
+
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
|
40
|
+
runs-on: ${{ matrix.os }}
|
41
|
+
strategy:
|
42
|
+
fail-fast: false
|
43
|
+
matrix:
|
44
|
+
include:
|
45
|
+
- os: ubuntu-18.04
|
46
|
+
platform: any
|
47
|
+
ruby-version: '2.7'
|
48
|
+
- os: ubuntu-18.04
|
49
|
+
platform: x86_64-linux
|
50
|
+
ruby-version: '2.7'
|
51
|
+
- os: windows-latest
|
52
|
+
platform: x64-mingw32
|
53
|
+
ruby-version: '2.7'
|
54
|
+
- os: windows-latest
|
55
|
+
platform: x64-mingw-ucrt
|
56
|
+
ruby-version: '3.1'
|
57
|
+
- os: macos-latest
|
58
|
+
platform: x86_64-darwin
|
59
|
+
ruby-version: '2.7'
|
60
|
+
steps:
|
61
|
+
- uses: actions/checkout@v3
|
62
|
+
|
63
|
+
- name: Setup Ruby
|
64
|
+
uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby-version }}
|
67
|
+
bundler-cache: true
|
68
|
+
|
69
|
+
- name: Workaround for vcpkg
|
70
|
+
if: startsWith(matrix.os, 'ubuntu')
|
71
|
+
run: |
|
72
|
+
sudo apt-get update
|
73
|
+
sudo apt-get install gperf
|
74
|
+
|
75
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
76
|
+
|
77
|
+
- uses: actions/upload-artifact@v2
|
78
|
+
with:
|
79
|
+
name: pkg
|
80
|
+
path: pkg/*.gem
|
81
|
+
|
82
|
+
cross-build:
|
83
|
+
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
|
84
|
+
runs-on: ${{ matrix.os }}
|
85
|
+
strategy:
|
86
|
+
fail-fast: false
|
87
|
+
matrix:
|
88
|
+
include:
|
89
|
+
- os: ubuntu-latest
|
90
|
+
platform: aarch64-linux
|
91
|
+
ruby-version: '2.7'
|
92
|
+
- os: macos-latest
|
93
|
+
platform: arm64-darwin
|
94
|
+
ruby-version: '2.7'
|
95
|
+
steps:
|
96
|
+
- uses: actions/checkout@v3
|
97
|
+
|
98
|
+
- name: Install Ubuntu packages
|
99
|
+
if: startsWith(matrix.os, 'ubuntu')
|
100
|
+
run: |
|
101
|
+
sudo apt-get update
|
102
|
+
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
103
|
+
|
104
|
+
- name: Install Ruby
|
105
|
+
uses: ruby/setup-ruby@v1
|
106
|
+
with:
|
107
|
+
ruby-version: ${{ matrix.ruby-version }}
|
108
|
+
bundler-cache: true
|
109
|
+
|
110
|
+
- name: Build native extension
|
111
|
+
run: bundle exec rake gem:native:${{ matrix.platform }}
|
112
|
+
|
113
|
+
- uses: actions/upload-artifact@v2
|
114
|
+
with:
|
115
|
+
name: pkg
|
116
|
+
path: pkg/*.gem
|
117
|
+
|
118
|
+
test-build:
|
119
|
+
needs: [ build, cross-build ]
|
120
|
+
runs-on: ${{ matrix.os }}
|
121
|
+
strategy:
|
122
|
+
fail-fast: false
|
123
|
+
matrix:
|
124
|
+
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
125
|
+
ruby-version: [ '2.7', '3.0', '3.1' ]
|
126
|
+
|
127
|
+
steps:
|
128
|
+
- uses: actions/checkout@v2
|
129
|
+
|
130
|
+
- uses: ruby/setup-ruby@v1
|
131
|
+
with:
|
132
|
+
ruby-version: ${{ matrix.ruby-version }}
|
133
|
+
|
134
|
+
- uses: actions/download-artifact@v2
|
135
|
+
with:
|
136
|
+
name: pkg
|
137
|
+
path: pkg
|
138
|
+
|
139
|
+
- name: Install binary gem
|
140
|
+
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION")-$(ruby -e "puts RUBY_PLATFORM.sub(/darwin\d{2}$/, 'darwin')").gem
|
141
|
+
# MacOS with have something like arm64-darwin19, others just aarch64-linux
|
142
|
+
- name: Test conversion
|
143
|
+
run: |
|
144
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
145
|
+
|
146
|
+
test-build-any:
|
147
|
+
needs: [ build, cross-build ]
|
148
|
+
runs-on: ${{ matrix.os }}
|
149
|
+
strategy:
|
150
|
+
fail-fast: false
|
151
|
+
matrix:
|
152
|
+
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
153
|
+
ruby-version: [ '2.7', '3.0', '3.1' ]
|
154
|
+
|
155
|
+
steps:
|
156
|
+
- uses: actions/checkout@v2
|
157
|
+
|
158
|
+
- uses: ruby/setup-ruby@v1
|
159
|
+
with:
|
160
|
+
ruby-version: ${{ matrix.ruby-version }}
|
161
|
+
|
162
|
+
- uses: actions/download-artifact@v2
|
163
|
+
with:
|
164
|
+
name: pkg
|
165
|
+
path: pkg
|
166
|
+
|
167
|
+
- name: Workaround for vcpkg
|
168
|
+
if: startsWith(matrix.os, 'ubuntu')
|
169
|
+
run: |
|
170
|
+
sudo apt-get update
|
171
|
+
sudo apt-get install gperf
|
172
|
+
|
173
|
+
- name: Install native gem
|
174
|
+
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
|
175
|
+
|
176
|
+
- name: Test conversion
|
177
|
+
run: |
|
178
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
@@ -9,7 +9,6 @@ jobs:
|
|
9
9
|
build:
|
10
10
|
runs-on: ${{ matrix.os }}
|
11
11
|
strategy:
|
12
|
-
max-parallel: 3
|
13
12
|
fail-fast: false
|
14
13
|
matrix:
|
15
14
|
include:
|
@@ -29,31 +28,38 @@ jobs:
|
|
29
28
|
platform: x86_64-darwin
|
30
29
|
ruby-version: '2.7'
|
31
30
|
steps:
|
32
|
-
|
31
|
+
- uses: actions/checkout@v3
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true
|
38
37
|
|
39
|
-
|
38
|
+
# https://github.com/microsoft/vcpkg/issues/15931
|
39
|
+
# no good solution :(
|
40
|
+
- name: Workaround for vcpkg
|
41
|
+
if: startsWith(matrix.os, 'ubuntu')
|
42
|
+
run: |
|
43
|
+
sudo apt-get update
|
44
|
+
sudo apt-get install gperf
|
40
45
|
|
41
|
-
|
42
|
-
with:
|
43
|
-
name: pkg
|
44
|
-
path: pkg/*.gem
|
46
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
+
- uses: actions/upload-artifact@v3
|
49
|
+
with:
|
50
|
+
name: pkg
|
51
|
+
path: pkg/*.gem
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
- name: Install gem
|
54
|
+
run: gem install -b pkg/emf2svg-*.gem
|
55
|
+
|
56
|
+
- name: Test conversion
|
57
|
+
run: |
|
58
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
52
59
|
|
53
60
|
cross:
|
54
61
|
runs-on: ${{ matrix.os }}
|
55
62
|
strategy:
|
56
|
-
max-parallel: 3
|
57
63
|
fail-fast: false
|
58
64
|
matrix:
|
59
65
|
include:
|
@@ -64,56 +70,55 @@ jobs:
|
|
64
70
|
platform: arm64-darwin
|
65
71
|
ruby-version: '2.7'
|
66
72
|
steps:
|
67
|
-
|
73
|
+
- uses: actions/checkout@v2
|
74
|
+
|
75
|
+
- name: Install packages
|
76
|
+
if: matrix.os == 'ubuntu-latest'
|
77
|
+
run: |
|
78
|
+
sudo apt-get update
|
79
|
+
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
68
80
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
74
|
-
|
75
|
-
- uses: ruby/setup-ruby@v1
|
76
|
-
with:
|
77
|
-
ruby-version: ${{ matrix.ruby-version }}
|
78
|
-
bundler-cache: true
|
81
|
+
- uses: ruby/setup-ruby@v1
|
82
|
+
with:
|
83
|
+
ruby-version: ${{ matrix.ruby-version }}
|
84
|
+
bundler-cache: true
|
79
85
|
|
80
|
-
|
86
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
81
87
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
88
|
+
- uses: actions/upload-artifact@v2
|
89
|
+
with:
|
90
|
+
name: pkg
|
91
|
+
path: pkg/*.gem
|
86
92
|
|
87
|
-
|
88
|
-
|
93
|
+
- name: Install gem
|
94
|
+
run: gem install -b pkg/emf2svg-*.gem
|
89
95
|
|
90
96
|
publish:
|
91
97
|
needs: [ build, cross ]
|
92
98
|
runs-on: ubuntu-latest
|
93
99
|
steps:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
for gem in pkg/*.gem; do gem push -V $gem; done
|
100
|
+
- uses: actions/checkout@v2
|
101
|
+
|
102
|
+
- uses: ruby/setup-ruby@v1
|
103
|
+
with:
|
104
|
+
ruby-version: '2.7'
|
105
|
+
bundler-cache: true
|
106
|
+
|
107
|
+
- uses: actions/download-artifact@v2
|
108
|
+
with:
|
109
|
+
name: pkg
|
110
|
+
path: pkg
|
111
|
+
|
112
|
+
- name: Publish to rubygems.org
|
113
|
+
env:
|
114
|
+
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
115
|
+
run: |
|
116
|
+
mkdir -p ~/.gem
|
117
|
+
touch ~/.gem/credentials
|
118
|
+
cat > ~/.gem/credentials << EOF
|
119
|
+
---
|
120
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
121
|
+
EOF
|
122
|
+
chmod 0600 ~/.gem/credentials
|
123
|
+
gem signin
|
124
|
+
for gem in pkg/*.gem; do gem push -V $gem; done
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -1,12 +1,22 @@
|
|
1
|
-
= emf2svg
|
1
|
+
= emf2svg Ruby gem for EMF to SVG conversion
|
2
|
+
|
3
|
+
image:https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml/badge.svg["Build", link="https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml"]
|
4
|
+
image:https://badge.fury.io/rb/emf2svg.svg["Gem Version", link="https://badge.fury.io/rb/emf2svg"]
|
2
5
|
|
3
6
|
== Purpose
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
The `emf2svg` Ruby gem provides a Ruby interface to the
|
9
|
+
https://github.com/kakwa/libemf2svg[libemf2svg] EMF-to-SVG conversion library.
|
10
|
+
|
11
|
+
NOTE: This gem currently uses the
|
12
|
+
https://github.com/metanorma/libemf2svg[Metanorma fork of libemf2svg]
|
13
|
+
until feature up-streaming is complete.
|
14
|
+
|
15
|
+
== Prerequisites
|
8
16
|
|
9
|
-
|
17
|
+
* Ruby version >= 2.6
|
18
|
+
|
19
|
+
== Install
|
10
20
|
|
11
21
|
Install the gem directly:
|
12
22
|
|
@@ -22,17 +32,106 @@ Or add it to your `Gemfile`:
|
|
22
32
|
gem 'emf2svg'
|
23
33
|
----
|
24
34
|
|
25
|
-
|
35
|
+
NOTE: For more information on how to install by compiling from source, see
|
36
|
+
<<install-from-source>>.
|
37
|
+
|
38
|
+
|
39
|
+
== Usage
|
40
|
+
|
41
|
+
This gem provides an interface to `libemf2svg`, allowing your Ruby code to
|
42
|
+
directly utilize EMF to SVG conversion facilities.
|
43
|
+
|
44
|
+
There are two ways to provide EMF data to `emf2svg`.
|
45
|
+
|
46
|
+
=== Loading from file
|
47
|
+
|
48
|
+
`Emf2svg.from_file`:: Loads an EMF file directly from the filesystem.
|
49
|
+
|
50
|
+
[example]
|
51
|
+
.Example of using `Emf2svg.from_file` and exporting an SVG file
|
52
|
+
====
|
53
|
+
[source,ruby]
|
54
|
+
----
|
55
|
+
require "emf2svg"
|
56
|
+
|
57
|
+
data = Emf2svg.from_file("example.emf", 800, 600)
|
58
|
+
File.write("output.svg", data, mode: "wb")
|
59
|
+
----
|
60
|
+
800, 600 - optional width and height of the bounding rectangle for svg file
|
61
|
+
The image will be scaled to fit into this rectangle
|
62
|
+
These parameters are optional. If skipped or set to 0 SVG image will have the
|
63
|
+
same size as EMF (in pixels)
|
64
|
+
====
|
65
|
+
|
66
|
+
=== Loading binary data
|
67
|
+
|
68
|
+
`Emf2svg.from_binary_string`:: Loads EMF content from binary form.
|
69
|
+
|
70
|
+
[example]
|
71
|
+
.Example of using `Emf2svg.from_binary_string` and exporting an SVG file
|
72
|
+
====
|
73
|
+
[source,ruby]
|
74
|
+
----
|
75
|
+
require "emf2svg"
|
76
|
+
|
77
|
+
emf_content = File.read("example.emf", mode: "rb")
|
78
|
+
svg_data = Emf2svg.from_binary_string(emf_content, 800, 600)
|
79
|
+
File.write("output.svg", svg_data, mode: "wb")
|
80
|
+
----
|
81
|
+
800, 600 - optional width and height of the bounding rectangle for svg file
|
82
|
+
The image will be scaled to fit into this rectangle
|
83
|
+
These parameters are optional. If skipped or set to 0 SVG image will have the
|
84
|
+
same size as EMF (in pixels)
|
85
|
+
====
|
86
|
+
|
87
|
+
|
88
|
+
[[packaging]]
|
89
|
+
== Packaging
|
90
|
+
|
91
|
+
=== Pre-compiled extensions or building from source
|
92
|
+
|
93
|
+
This gem is distributed with pre-compiled native extensions for a set of
|
94
|
+
supported machine architectures.
|
95
|
+
|
96
|
+
On supported platforms, this removes the need for compiling the C extension and
|
97
|
+
the installation of system dependencies. This results in much faster and a more
|
98
|
+
reliable installation step.
|
99
|
+
|
100
|
+
The pre-compiled platforms are:
|
26
101
|
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
102
|
+
* `x86_64-linux` (GNU and `musl` flavors)
|
103
|
+
* `aarch64-linux` (GNU and `musl` flavors)
|
104
|
+
* `x86_64-darwin`
|
105
|
+
* `arm64-darwin`
|
106
|
+
* `x64-mingw32`
|
107
|
+
* `x64-mingw-ucrt`
|
108
|
+
|
109
|
+
When installing the gem, Ruby will automatically select a pre-compiled version
|
110
|
+
suitable for your platform, or opt to install from source if the platform
|
111
|
+
is not supported.
|
112
|
+
|
113
|
+
[[install-from-source]]
|
114
|
+
=== Installing from source
|
115
|
+
|
116
|
+
==== General
|
117
|
+
|
118
|
+
For platforms that require compilation, the `emf2svg` build script will
|
119
|
+
automatically compile the native extension locally.
|
120
|
+
|
121
|
+
The `emf2svg` build script maintains and installs all required libraries and
|
122
|
+
other dependencies using the `vcpkg` package manager.
|
123
|
+
|
124
|
+
Prior to installation, the system must already have install the appropriate
|
125
|
+
build system (such as `gcc`, `clang` or Visual Studio), and CMake.
|
126
|
+
|
127
|
+
==== Build prerequisites by platform
|
31
128
|
|
32
129
|
==== Windows
|
33
130
|
|
34
|
-
On Windows all necessary libraries are
|
35
|
-
Studio 2019 with C++ Build Tools
|
131
|
+
On Windows, while all necessary libraries are already pre-compiled, Visual
|
132
|
+
Studio 2019 with C++ Build Tools still need to be installed.
|
133
|
+
|
134
|
+
They can be downloaded
|
36
135
|
https://visualstudio.microsoft.com/downloads/[here], or installed with
|
37
136
|
Chocolatey:
|
38
137
|
|
@@ -43,62 +142,45 @@ choco install visualstudio2019buildtools -y --no-progress --package-parameters "
|
|
43
142
|
|
44
143
|
==== macOS
|
45
144
|
|
145
|
+
On macOS, CMake needs to be installed.
|
146
|
+
|
46
147
|
[source,sh]
|
47
148
|
----
|
48
149
|
brew install cmake
|
49
150
|
----
|
50
151
|
|
51
|
-
==== Linux
|
152
|
+
==== Linux: Debian
|
52
153
|
|
53
|
-
|
154
|
+
On Debian, the following build tools need to be installed.
|
54
155
|
|
55
156
|
[source,sh]
|
56
157
|
----
|
57
|
-
# compiler
|
58
|
-
|
158
|
+
# Choose your preferred compiler
|
159
|
+
# GCC
|
160
|
+
apt-get install gcc g++ gperf cmake pkg-config
|
59
161
|
# or
|
60
|
-
|
61
|
-
|
62
|
-
# build deps
|
63
|
-
apt-get install cmake pkg-config
|
64
|
-
|
65
|
-
# library deps with their headers
|
66
|
-
apt-get install libpng-dev libc6-dev libfontconfig1-dev libfreetype6-dev zlib1g-dev
|
162
|
+
# clang
|
163
|
+
apt-get install clang gperf cmake pkg-config
|
67
164
|
----
|
68
165
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
----
|
73
|
-
yum install cmake libpng-devel freetype-devel fontconfig-devel gcc-c++ gcc
|
74
|
-
----
|
166
|
+
NOTE: On Debian systems, there exists a
|
167
|
+
https://github.com/microsoft/vcpkg/issues/15931[vcpkg bug] that needs to be
|
168
|
+
addressed by installing the `gperf` package in addition to other build tools.
|
75
169
|
|
76
|
-
|
170
|
+
==== Linux: Fedora
|
77
171
|
|
78
|
-
|
79
|
-
conversion facilities.
|
172
|
+
On Fedora, the following build tools need to be installed.
|
80
173
|
|
81
|
-
[source,
|
82
|
-
----
|
83
|
-
require "emf2svg"
|
84
|
-
|
85
|
-
data = Emf2svg.from_file("example.emf")
|
86
|
-
File.write("output.svg", data, mode: "wb")
|
174
|
+
[source,sh]
|
87
175
|
----
|
88
|
-
|
89
|
-
It also can use content of emf as an input:
|
90
|
-
|
91
|
-
[source,ruby]
|
176
|
+
yum install cmake gcc-c++ gcc
|
92
177
|
----
|
93
|
-
require "emf2svg"
|
94
178
|
|
95
|
-
emf_content = File.read("example.emf", mode: "rb")
|
96
|
-
svg_data = Emf2svg.from_binary_string(emf_content)
|
97
|
-
File.write("output.svg", svg_data, mode: "wb")
|
98
|
-
----
|
99
179
|
|
100
180
|
== Development
|
101
181
|
|
182
|
+
=== Basic steps
|
183
|
+
|
102
184
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
103
185
|
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
104
186
|
prompt that will allow you to experiment.
|
@@ -109,6 +191,7 @@ release a new version, update the version number in `version.rb`, and then run
|
|
109
191
|
git commits and the created tag, and push the `.gem` file to
|
110
192
|
https://rubygems.org[rubygems.org].
|
111
193
|
|
194
|
+
|
112
195
|
=== Releasing
|
113
196
|
|
114
197
|
Releasing is done automatically with GitHub Actions. Just bump and tag with
|
@@ -128,6 +211,7 @@ For a minor release (0.x.0) use:
|
|
128
211
|
gem bump --version minor --tag --push
|
129
212
|
----
|
130
213
|
|
214
|
+
|
131
215
|
== Contributing
|
132
216
|
|
133
217
|
Bug reports and pull requests are welcome on GitHub at
|
@@ -136,6 +220,7 @@ safe, welcoming space for collaboration, and contributors are expected to adhere
|
|
136
220
|
to the
|
137
221
|
https://github.com/metanorma/emf2svg-ruby/blob/master/CODE_OF_CONDUCT.md[code of conduct].
|
138
222
|
|
223
|
+
|
139
224
|
== Code of Conduct
|
140
225
|
|
141
226
|
Everyone interacting in the emf2svg project's codebases, issue trackers, chat
|
data/Rakefile
CHANGED
data/bin/emf2svg
CHANGED
@@ -1,8 +1,38 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "bundler/setup"
|
5
4
|
require "emf2svg"
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
def print_usage
|
7
|
+
usage = %{Usage: emf2svg <input> <output> [<width>] [<height>]
|
8
|
+
<input> -- emf file to convert
|
9
|
+
<output> -- svg file to save
|
10
|
+
<width> -- svg image width, defaults to source width in px if not set or 0
|
11
|
+
<height> -- svg image height, defaults to source height in px if not set or 0
|
12
|
+
Note: width and height specify bounding rectangle, the image will be scaled
|
13
|
+
propotionally to fit into it.
|
14
|
+
}
|
15
|
+
puts usage
|
16
|
+
end
|
17
|
+
|
18
|
+
def tint(pos)
|
19
|
+
ARGV.size > pos ? Integer(ARGV[pos]) : 0
|
20
|
+
rescue ArgumentError, TypeError => e
|
21
|
+
puts "ERROR: Failed to convert #{ARGV[pos]} to integer: #{e.message}"
|
22
|
+
print_usage
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
if ARGV.size < 2 || ARGV.size > 4 || ARGV[0].casecmp("help").zero?
|
27
|
+
print_usage
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
svg = Emf2svg.from_file(ARGV[0], tint(2), tint(3))
|
33
|
+
File.write(ARGV[1], svg, mode: "wb")
|
34
|
+
rescue StandardError => e
|
35
|
+
puts "ERROR: Failed to process #{ARGV[0]}: #{e.message}"
|
36
|
+
print_usage
|
37
|
+
exit 1
|
38
|
+
end
|
data/emf2svg.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Ribose"]
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "EMF to SVG conversion in Ruby."
|
12
12
|
spec.homepage = "https://github.com/metanorma/emf2svg-ruby"
|
13
13
|
spec.license = "BSD-2-Clause"
|
14
|
-
spec.required_ruby_version = ">= 2.
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/metanorma/emf2svg-ruby"
|
data/exe/emf2svg
CHANGED
@@ -3,5 +3,36 @@
|
|
3
3
|
|
4
4
|
require "emf2svg"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
def print_usage
|
7
|
+
usage = %{Usage: emf2svg <input> <output> [<width>] [<height>]
|
8
|
+
<input> -- emf file to convert
|
9
|
+
<output> -- svg file to save
|
10
|
+
<width> -- svg image width, defaults to source width in px if not set or 0
|
11
|
+
<height> -- svg image height, defaults to source height in px if not set or 0
|
12
|
+
Note: width and height specify bounding rectangle, the image will be scaled
|
13
|
+
propotionally to fit into it.
|
14
|
+
}
|
15
|
+
puts usage
|
16
|
+
end
|
17
|
+
|
18
|
+
def tint(pos)
|
19
|
+
ARGV.size > pos ? Integer(ARGV[pos]) : 0
|
20
|
+
rescue ArgumentError, TypeError => e
|
21
|
+
puts "ERROR: Failed to convert #{ARGV[pos]} to integer: #{e.message}"
|
22
|
+
print_usage
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
if ARGV.size < 2 || ARGV.size > 4 || ARGV[0].casecmp("help").zero?
|
27
|
+
print_usage
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
svg = Emf2svg.from_file(ARGV[0], tint(2), tint(3))
|
33
|
+
File.write(ARGV[1], svg, mode: "wb")
|
34
|
+
rescue StandardError => e
|
35
|
+
puts "ERROR: Failed to process #{ARGV[0]}: #{e.message}"
|
36
|
+
print_usage
|
37
|
+
exit 1
|
38
|
+
end
|
data/lib/emf2svg/recipe.rb
CHANGED
@@ -2,17 +2,19 @@ require "rbconfig"
|
|
2
2
|
require "mini_portile2"
|
3
3
|
require "pathname"
|
4
4
|
require "tmpdir"
|
5
|
+
require "open3"
|
6
|
+
require_relative "version"
|
5
7
|
|
6
8
|
module Emf2svg
|
7
9
|
class Recipe < MiniPortileCMake
|
8
10
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
9
11
|
|
10
12
|
def initialize
|
11
|
-
super("libemf2svg",
|
13
|
+
super("libemf2svg", LIBEMF2SVG_VERSION)
|
12
14
|
|
13
15
|
@files << {
|
14
|
-
url: "https://github.com/metanorma/libemf2svg/releases/download/
|
15
|
-
sha256: "
|
16
|
+
url: "https://github.com/metanorma/libemf2svg/releases/download/v#{LIBEMF2SVG_VERSION}/libemf2svg.tar.gz",
|
17
|
+
sha256: "c65f25040a351d18beb5172609a55d034245f85a1152d7f294780c6cc155d876", # rubocop:disable Layout/LineLength
|
16
18
|
}
|
17
19
|
|
18
20
|
@target = ROOT.join(@target).to_s
|
@@ -25,65 +27,15 @@ module Emf2svg
|
|
25
27
|
|
26
28
|
def cook
|
27
29
|
super
|
28
|
-
|
29
30
|
FileUtils.touch(checkpoint)
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
def host_platform
|
35
|
-
@host_platform ||=
|
36
|
-
case @host
|
37
|
-
when /\Ax86_64.*mingw32/
|
38
|
-
"x64-mingw32"
|
39
|
-
when /\Ai[3-6]86.*mingw32/
|
40
|
-
"x86-mingw32"
|
41
|
-
when /\Ax86_64.*linux/
|
42
|
-
"x86_64-linux"
|
43
|
-
when /\A(arm64|aarch64).*linux/
|
44
|
-
"arm64-linux"
|
45
|
-
when /\Ai[3-6]86.*linux/
|
46
|
-
"x86-linux"
|
47
|
-
when /\Ax86_64.*(darwin|macos|osx)/
|
48
|
-
"x86_64-darwin"
|
49
|
-
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
50
|
-
"arm64-darwin"
|
51
|
-
else
|
52
|
-
@host
|
53
|
-
end
|
33
|
+
def windows_native?
|
34
|
+
MiniPortile.windows? && target_triplet.eql?("x64-mingw-static")
|
54
35
|
end
|
55
36
|
|
56
|
-
def
|
57
|
-
|
58
|
-
case ENV["target_platform"]
|
59
|
-
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
60
|
-
"arm64-darwin"
|
61
|
-
when /\Ac86_64.*(darwin|macos|osx)/
|
62
|
-
"x86_64-darwin"
|
63
|
-
when /\A(arm64|aarch64).*linux/
|
64
|
-
"arm64-linux"
|
65
|
-
else
|
66
|
-
ENV["target_platform"] || host_platform
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def target_triplet
|
71
|
-
@target_triplet ||=
|
72
|
-
case target_platform
|
73
|
-
when "arm64-darwin"
|
74
|
-
"arm64-osx"
|
75
|
-
when "x86_64-darwin"
|
76
|
-
"x86_64-osx"
|
77
|
-
else
|
78
|
-
target_platform
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
83
|
-
# rubocop:enable Metrics/MethodLength
|
84
|
-
|
85
|
-
def cross_compiling?
|
86
|
-
not host_platform.eql? target_platform
|
37
|
+
def drop_target_triplet?
|
38
|
+
windows_native? || host_platform.eql?(target_platform)
|
87
39
|
end
|
88
40
|
|
89
41
|
def checkpoint
|
@@ -94,16 +46,14 @@ module Emf2svg
|
|
94
46
|
opts = []
|
95
47
|
|
96
48
|
opts << "-DCMAKE_BUILD_TYPE=Release"
|
49
|
+
opts << "-DLONLY=ON"
|
97
50
|
|
98
|
-
|
99
|
-
opts << "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
|
100
|
-
end
|
101
|
-
|
102
|
-
if cross_compiling? && (not MiniPortile.windows?)
|
103
|
-
message("Cross-compiling on #{host_platform} for #{target_platform}\n")
|
51
|
+
unless target_triplet.nil? || drop_target_triplet?
|
104
52
|
opts << "-DVCPKG_TARGET_TRIPLET=#{target_triplet}"
|
105
53
|
end
|
106
54
|
|
55
|
+
opts << "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
|
56
|
+
|
107
57
|
opts
|
108
58
|
end
|
109
59
|
|
@@ -115,6 +65,28 @@ module Emf2svg
|
|
115
65
|
"cmake --build #{File.expand_path(work_path)} --config Release"
|
116
66
|
end
|
117
67
|
|
68
|
+
def lb_to_verify
|
69
|
+
pt = if MiniPortile.windows?
|
70
|
+
"emf2svg.dll"
|
71
|
+
else
|
72
|
+
"libemf2svg.{so,dylib}"
|
73
|
+
end
|
74
|
+
@lb_to_verify ||= Dir.glob(ROOT.join("lib", "emf2svg", pt))
|
75
|
+
end
|
76
|
+
|
77
|
+
def verify_libs
|
78
|
+
lb_to_verify.each do |l|
|
79
|
+
out, st = Open3.capture2("file #{l}")
|
80
|
+
raise "Failed to query file #{l}: #{out}" unless st.exitstatus.zero?
|
81
|
+
|
82
|
+
if out.include?(target_format)
|
83
|
+
message("Verifying #{l} ... OK\n")
|
84
|
+
else
|
85
|
+
raise "Invalid file format '#{out}', '#{@target_format}' expected"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
118
90
|
def install
|
119
91
|
libs = if MiniPortile.windows?
|
120
92
|
Dir.glob(File.join(work_path, "Release", "*.dll"))
|
@@ -122,12 +94,13 @@ module Emf2svg
|
|
122
94
|
Dir.glob(File.join(work_path, "libemf2svg.{so,dylib}"))
|
123
95
|
.grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib)$/)
|
124
96
|
end
|
125
|
-
|
126
97
|
FileUtils.cp_r(libs, ROOT.join("lib", "emf2svg"), verbose: true)
|
98
|
+
|
99
|
+
verify_libs unless target_format.eql?("skip")
|
127
100
|
end
|
128
101
|
|
129
102
|
def execute(action, command, command_opts = {})
|
130
|
-
super(action, command, command_opts.merge(debug:
|
103
|
+
super(action, command, command_opts.merge(debug: false))
|
131
104
|
end
|
132
105
|
|
133
106
|
def message(text)
|
@@ -150,5 +123,75 @@ module Emf2svg
|
|
150
123
|
def port_path
|
151
124
|
"port"
|
152
125
|
end
|
126
|
+
|
127
|
+
# rubocop:disable Metrics/MethodLength
|
128
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
129
|
+
def host_platform
|
130
|
+
@host_platform ||=
|
131
|
+
case @host
|
132
|
+
when /\Ax86_64.*mingw32/
|
133
|
+
"x64-mingw32"
|
134
|
+
when /\Ax86_64.*linux/
|
135
|
+
"x86_64-linux"
|
136
|
+
when /\A(arm64|aarch64).*linux/
|
137
|
+
"arm64-linux"
|
138
|
+
when /\Ax86_64.*(darwin|macos|osx)/
|
139
|
+
"x86_64-darwin"
|
140
|
+
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
141
|
+
"arm64-darwin"
|
142
|
+
else
|
143
|
+
@host
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def target_platform
|
148
|
+
@target_platform ||=
|
149
|
+
case ENV.fetch("target_platform", nil)
|
150
|
+
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
151
|
+
"arm64-darwin"
|
152
|
+
when /\Ax86_64.*(darwin|macos|osx)/
|
153
|
+
"x86_64-darwin"
|
154
|
+
when /\A(arm64|aarch64).*linux/
|
155
|
+
"aarch64-linux"
|
156
|
+
else
|
157
|
+
ENV.fetch("target_platform", host_platform)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def target_triplet
|
162
|
+
@target_triplet ||=
|
163
|
+
case target_platform
|
164
|
+
when "arm64-darwin"
|
165
|
+
"arm64-osx"
|
166
|
+
when "x86_64-darwin"
|
167
|
+
"x64-osx"
|
168
|
+
when "aarch64-linux"
|
169
|
+
"arm64-linux"
|
170
|
+
when "x86_64-linux"
|
171
|
+
"x64-linux"
|
172
|
+
when /\Ax64-mingw(32|-ucrt)/
|
173
|
+
"x64-mingw-static"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def target_format
|
178
|
+
@target_format ||=
|
179
|
+
case target_platform
|
180
|
+
when "arm64-darwin"
|
181
|
+
"Mach-O 64-bit dynamically linked shared library arm64"
|
182
|
+
when "x86_64-darwin"
|
183
|
+
"Mach-O 64-bit dynamically linked shared library x86_64"
|
184
|
+
when "aarch64-linux"
|
185
|
+
"ELF 64-bit LSB shared object, ARM aarch64"
|
186
|
+
when "x86_64-linux"
|
187
|
+
"ELF 64-bit LSB shared object, x86-64"
|
188
|
+
when /\Ax64-mingw(32|-ucrt)/
|
189
|
+
"PE32+ executable (DLL) (console) x86-64, for MS Windows"
|
190
|
+
else
|
191
|
+
"skip"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
195
|
+
# rubocop:enable Metrics/MethodLength
|
153
196
|
end
|
154
197
|
end
|
data/lib/emf2svg/version.rb
CHANGED
data/lib/emf2svg.rb
CHANGED
@@ -39,17 +39,18 @@ module Emf2svg
|
|
39
39
|
:int
|
40
40
|
|
41
41
|
class << self
|
42
|
-
def from_file(path)
|
42
|
+
def from_file(path, width = 0, height = 0)
|
43
43
|
content = File.read(path, mode: "rb")
|
44
|
-
from_binary_string(content)
|
44
|
+
from_binary_string(content, width, height)
|
45
45
|
end
|
46
46
|
|
47
|
-
def from_binary_string(content)
|
47
|
+
def from_binary_string(content, width = 0, height = 0)
|
48
48
|
svg_out = FFI::MemoryPointer.new(:pointer)
|
49
49
|
svg_out_len = FFI::MemoryPointer.new(:pointer)
|
50
50
|
content_ptr = FFI::MemoryPointer.from_string(content)
|
51
51
|
|
52
|
-
|
52
|
+
opt = options(width, height)
|
53
|
+
ret = emf2svg(content_ptr, content.size, svg_out, svg_out_len, opt)
|
53
54
|
raise Error, "emf2svg failed with error code: #{ret}" unless ret == 1
|
54
55
|
|
55
56
|
svg_out.read_pointer.read_bytes(svg_out_len.read_int)
|
@@ -57,13 +58,13 @@ module Emf2svg
|
|
57
58
|
|
58
59
|
private
|
59
60
|
|
60
|
-
def options
|
61
|
+
def options(width, height)
|
61
62
|
GeneratorOptions.new.tap do |opts|
|
62
63
|
opts[:verbose] = false
|
63
64
|
opts[:emfplus] = true
|
64
65
|
opts[:svgDelimiter] = true
|
65
|
-
opts[:imgHeight] =
|
66
|
-
opts[:imgWidth] =
|
66
|
+
opts[:imgHeight] = height
|
67
|
+
opts[:imgWidth] = width
|
67
68
|
end
|
68
69
|
end
|
69
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emf2svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -89,7 +89,7 @@ extensions:
|
|
89
89
|
- ext/extconf.rb
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
-
- ".github/workflows/
|
92
|
+
- ".github/workflows/build.yml"
|
93
93
|
- ".github/workflows/release.yml"
|
94
94
|
- ".gitignore"
|
95
95
|
- ".rspec"
|
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 2.
|
126
|
+
version: 2.6.0
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -133,5 +133,5 @@ requirements: []
|
|
133
133
|
rubygems_version: 3.1.6
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
|
-
summary:
|
136
|
+
summary: EMF to SVG conversion in Ruby.
|
137
137
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
name: main
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
workflow_dispatch:
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
runs-on: ${{ matrix.os }}
|
12
|
-
strategy:
|
13
|
-
max-parallel: 4
|
14
|
-
fail-fast: false
|
15
|
-
matrix:
|
16
|
-
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
17
|
-
ruby-version: [ '2.7' ]
|
18
|
-
include:
|
19
|
-
- os: windows-latest
|
20
|
-
ruby-version: '3.1'
|
21
|
-
steps:
|
22
|
-
- uses: actions/checkout@v2
|
23
|
-
|
24
|
-
- uses: ruby/setup-ruby@v1
|
25
|
-
with:
|
26
|
-
bundler-cache: true
|
27
|
-
ruby-version: ${{ matrix.ruby-version }}
|
28
|
-
|
29
|
-
- run: bundle exec rake
|
30
|
-
|
31
|
-
build:
|
32
|
-
runs-on: ${{ matrix.os }}
|
33
|
-
strategy:
|
34
|
-
max-parallel: 4
|
35
|
-
fail-fast: false
|
36
|
-
matrix:
|
37
|
-
include:
|
38
|
-
- os: ubuntu-18.04
|
39
|
-
platform: any
|
40
|
-
ruby-version: '2.7'
|
41
|
-
- os: ubuntu-18.04
|
42
|
-
platform: x86_64-linux
|
43
|
-
ruby-version: '2.7'
|
44
|
-
- os: windows-latest
|
45
|
-
platform: x64-mingw32
|
46
|
-
ruby-version: '2.7'
|
47
|
-
- os: windows-latest
|
48
|
-
platform: x64-mingw-ucrt
|
49
|
-
ruby-version: '3.1'
|
50
|
-
- os: macos-latest
|
51
|
-
platform: x86_64-darwin
|
52
|
-
ruby-version: '2.7'
|
53
|
-
steps:
|
54
|
-
- uses: actions/checkout@v2
|
55
|
-
|
56
|
-
- uses: ruby/setup-ruby@v1
|
57
|
-
with:
|
58
|
-
ruby-version: ${{ matrix.ruby-version }}
|
59
|
-
bundler-cache: true
|
60
|
-
|
61
|
-
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
62
|
-
|
63
|
-
- uses: actions/upload-artifact@v2
|
64
|
-
with:
|
65
|
-
name: pkg
|
66
|
-
path: pkg/*.gem
|
67
|
-
|
68
|
-
- name: Install gem
|
69
|
-
run: gem install -b pkg/emf2svg-*.gem
|
70
|
-
|
71
|
-
- name: Test conversion
|
72
|
-
run: |
|
73
|
-
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
74
|
-
|
75
|
-
test-build:
|
76
|
-
needs: build
|
77
|
-
runs-on: ${{ matrix.os }}
|
78
|
-
strategy:
|
79
|
-
max-parallel: 4
|
80
|
-
fail-fast: false
|
81
|
-
matrix:
|
82
|
-
include:
|
83
|
-
- os: ubuntu-latest
|
84
|
-
platform: any
|
85
|
-
ruby-version: '2.7'
|
86
|
-
- os: windows-latest
|
87
|
-
platform: any
|
88
|
-
ruby-version: '2.7'
|
89
|
-
- os: macos-latest
|
90
|
-
platform: any
|
91
|
-
ruby-version: '2.7'
|
92
|
-
- os: ubuntu-18.04
|
93
|
-
platform: x86_64-linux
|
94
|
-
ruby-version: '2.7'
|
95
|
-
- os: ubuntu-latest
|
96
|
-
platform: x86_64-linux
|
97
|
-
ruby-version: '2.7'
|
98
|
-
- os: windows-latest
|
99
|
-
platform: x64-mingw32
|
100
|
-
ruby-version: '2.7'
|
101
|
-
- os: windows-latest
|
102
|
-
platform: x64-mingw-ucrt
|
103
|
-
ruby-version: '3.1'
|
104
|
-
- os: macos-latest
|
105
|
-
platform: x86_64-darwin
|
106
|
-
ruby-version: '2.7'
|
107
|
-
|
108
|
-
steps:
|
109
|
-
- uses: actions/checkout@v2
|
110
|
-
|
111
|
-
- uses: ruby/setup-ruby@v1
|
112
|
-
with:
|
113
|
-
ruby-version: ${{ matrix.ruby-version }}
|
114
|
-
|
115
|
-
- uses: actions/download-artifact@v2
|
116
|
-
with:
|
117
|
-
name: pkg
|
118
|
-
path: pkg
|
119
|
-
|
120
|
-
- name: Install native gem
|
121
|
-
if: matrix.platform == 'any'
|
122
|
-
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
|
123
|
-
|
124
|
-
- name: Install binary gem
|
125
|
-
if: matrix.platform != 'any'
|
126
|
-
run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem
|
127
|
-
|
128
|
-
- name: Test conversion
|
129
|
-
run: |
|
130
|
-
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
131
|
-
|
132
|
-
cross:
|
133
|
-
runs-on: ${{ matrix.os }}
|
134
|
-
strategy:
|
135
|
-
max-parallel: 4
|
136
|
-
fail-fast: false
|
137
|
-
matrix:
|
138
|
-
include:
|
139
|
-
- os: ubuntu-latest
|
140
|
-
platform: aarch64-linux
|
141
|
-
ruby-version: '2.7'
|
142
|
-
- os: macos-latest
|
143
|
-
platform: arm64-darwin
|
144
|
-
ruby-version: '2.7'
|
145
|
-
steps:
|
146
|
-
- uses: actions/checkout@v2
|
147
|
-
|
148
|
-
- name: Install packages
|
149
|
-
if: matrix.os == 'ubuntu-latest'
|
150
|
-
run: |
|
151
|
-
sudo apt-get update
|
152
|
-
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
153
|
-
|
154
|
-
- uses: ruby/setup-ruby@v1
|
155
|
-
with:
|
156
|
-
ruby-version: ${{ matrix.ruby-version }}
|
157
|
-
bundler-cache: true
|
158
|
-
|
159
|
-
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
160
|
-
|
161
|
-
- uses: actions/upload-artifact@v2
|
162
|
-
with:
|
163
|
-
name: pkg
|
164
|
-
path: pkg/*.gem
|
165
|
-
|
166
|
-
- name: Install gem
|
167
|
-
run: gem install -b pkg/emf2svg-*.gem
|