@@ -33,84 +33,56 @@ jobs:
33
33
with :
34
34
toolchain : stable${{ matrix.toolchain-suffix }}
35
35
36
+ - name : Install pkgconf
37
+ if : runner.os == 'Windows'
38
+ uses : msys2/setup-msys2@v2
39
+ id : msys2
40
+ with :
41
+ msystem : ucrt64
42
+ install : mingw-w64-ucrt-x86_64-pkgconf
43
+
44
+ - name : Put pkgconf on PATH
45
+ if : runner.os == 'Windows'
46
+ run : Add-Content $env:GITHUB_PATH "${{ steps.msys2.outputs.msys2-location }}\ucrt64\bin"
47
+
36
48
- name : Install cargo-c applet
37
- run : |
38
- cargo install --path .
49
+ run : cargo install --path .
39
50
40
51
- name : Test example project
41
52
working-directory : example-project
42
- run : |
43
- cargo test --verbose
53
+ run : cargo test --verbose
44
54
45
55
- name : Build C API for example project
46
56
working-directory : example-project
47
- run : |
48
- cargo cbuild --verbose --release
57
+ run : cargo cbuild --verbose --release
49
58
50
59
- name : Run C API tests for example project
51
60
working-directory : example-project
52
- run : |
53
- cargo ctest --verbose --release
61
+ run : cargo ctest --verbose --release
54
62
55
- - name : Install into temporary location
63
+ - name : Install into /usr/local
64
+ if : runner.os != 'Windows'
56
65
working-directory : example-project
57
- run : |
58
- cargo cinstall --verbose --release --destdir=temp
66
+ run : sudo -E env PATH=$PATH cargo cinstall --verbose --release --prefix=/usr/local
59
67
60
- - name : Copy installed files to /usr/local
61
- if : startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
62
- working-directory : example-project
63
- run : |
64
- sudo cp -r temp/usr/local/* /usr/local/
65
-
66
- - name : Install into Cargo root
67
- if : startsWith(matrix.os, 'windows')
68
- shell : bash
68
+ - name : Install into MSYS2 root
69
+ if : runner.os == 'Windows'
69
70
working-directory : example-project
70
- run : |
71
- cargo cinstall --verbose --release --prefix=$CARGO_HOME
71
+ run : cargo cinstall --verbose --release --prefix="${{ steps.msys2.outputs.msys2-location }}\ucrt64"
72
72
73
- - name : Test pkg-config
74
- if : startsWith(matrix .os, 'macos')
73
+ - name : Test pkgconf
74
+ if : runner .os == 'macOS'
75
75
run : |
76
76
set -x
77
- test "$(pkg-config --cflags example_project)" = "-I/usr/local/include/example-project-0.1"
78
- test "$(pkg-config --libs example_project)" = "-L/usr/local/lib -lexample-project"
79
-
80
- - name : Install pkgconf
81
- if : startsWith(matrix.os, 'ubuntu')
82
- uses : awalsh128/cache-apt-pkgs-action@latest
83
- with :
84
- packages : pkgconf
85
-
86
- - name : Setup Meson + Ninja
87
- if : startsWith(matrix.os, 'windows')
88
- run : |
89
- python3 -m pip install --upgrade pip setuptools wheel
90
- python3 -m pip install meson ninja
91
-
92
- - name : Setup MSVC for test
93
- if : startsWith(matrix.os, 'windows')
94
- uses : ilammy/msvc-dev-cmd@v1
95
- with :
96
- arch : x86_64
97
-
98
- # https://github.com/pkgconf/pkgconf/issues/364
99
- - name : Install pkgconf
100
- if : startsWith(matrix.os, 'windows')
101
- run : |
102
- git clone https://github.com/amyspark/pkgconf --branch msvc
103
- cd pkgconf
104
- meson setup build --prefix=$env:CARGO_HOME
105
- meson compile -C build
106
- meson install -C build
77
+ pkgconf --version
78
+ test "$(pkgconf --cflags example_project)" = "-I/usr/local/include/example-project-0.1"
79
+ test "$(pkgconf --libs example_project)" = "-L/usr/local/lib -lexample-project"
107
80
108
81
- name : Test pkgconf
109
- if : startsWith(matrix .os, 'ubuntu')
82
+ if : runner .os == 'Linux'
110
83
run : |
111
84
set -x
112
85
pkgconf --version
113
- pkg-config --version
114
86
ARCHDIR=`dpkg-architecture -qDEB_HOST_MULTIARCH`
115
87
# ubuntu seems to add trailing spaces for no specific reasons.
116
88
CFLAGS=$(pkgconf --cflags example_project)
@@ -120,34 +92,41 @@ jobs:
120
92
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
121
93
122
94
- name : Test pkgconf
123
- if : startsWith(matrix .os, 'windows')
95
+ if : runner .os == 'Windows'
124
96
shell : bash
125
97
run : |
126
98
set -x
127
99
pkgconf --version
128
- CFLAGS=$(pkgconf --cflags example_project)
129
- LIBS=$(pkgconf --libs example_project)
130
-
131
- test "${CFLAGS%% }" = "-I${CARGO_HOME//\\//}/bin/../include/example-project-0.1"
132
- test "${LIBS%% }" = "-L${CARGO_HOME//\\//}/bin/../lib -lexample-project"
100
+ # use --define-variable=prefix=C:/foo to test relative libdir/includedir generation
101
+ # https://github.com/lu-zero/cargo-c/commit/76a66cd72eb4271501557eebea7060821e63b702
102
+ test "$(pkgconf --define-variable=prefix=C:/foo --cflags example_project)" = "-IC:/foo/include/example-project-0.1"
103
+ test "$(pkgconf --define-variable=prefix=C:/foo --libs example_project)" = "-LC:/foo/lib -lexample-project"
133
104
134
105
- name : Update dynamic linker cache
135
- if : startsWith(matrix.os, 'ubuntu')
136
- run : |
137
- sudo ldconfig
106
+ if : runner.os == 'Linux'
107
+ run : sudo ldconfig
138
108
139
109
- name : Test usage from C (using Makefile)
140
- if : startsWith(matrix .os, 'macos') || startsWith(matrix.os, 'ubuntu')
110
+ if : runner .os != 'Windows'
141
111
working-directory : example-project/usage-from-c
112
+ run : make
113
+
114
+ - name : Setup Meson + Ninja
115
+ if : runner.os == 'Windows' && matrix.toolchain-suffix == '-msvc'
142
116
run : |
143
- make
117
+ python3 -m pip install --upgrade pip setuptools wheel
118
+ python3 -m pip install meson ninja
119
+
120
+ - name : Setup MSVC for test
121
+ if : runner.os == 'Windows' && matrix.toolchain-suffix == '-msvc'
122
+ uses : ilammy/msvc-dev-cmd@v1
123
+ with :
124
+ arch : x86_64
144
125
145
126
- name : Test usage from C (Meson)
146
- if : startsWith(matrix .os, 'windows') && matrix.toolchain-suffix == '-msvc'
127
+ if : runner .os == 'Windows' && matrix.toolchain-suffix == '-msvc'
147
128
working-directory : example-project/usage-from-c
148
- shell : pwsh
149
129
run : |
150
- $env:PKG_CONFIG="$env:CARGO_HOME/bin/pkgconf.exe"
151
130
meson setup build
152
131
meson compile -C build
153
132
meson test -C build
0 commit comments