-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
234 lines (213 loc) · 7.87 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
variables:
FFMPEG_VERSION: "4.4"
FFMPEG_PACKAGE_VERSION: "4.4.0.$(Build.BuildId)"
jobs:
- job: windows_cross
strategy:
maxParallel: 2
matrix:
x86:
arch: x86
targetOs: mingw32
crossPrefix: i686-w64-mingw32
rid: win7-x86
package: w64-i686
x64:
arch: x86_64
targetOs: mingw32
crossPrefix: x86_64-w64-mingw32
rid: win7-x64
package: w64-x86-64
pool:
vmImage: ubuntu-20.04
container:
image: ubuntu:18.04
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
steps:
- script: |
/tmp/docker exec -t -u 0 ci-container \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: Set up sudo
- script: |
sudo apt-get install -y build-essential gcc-mingw-$(package) g++-mingw-$(package) yasm libunwind8 wget git pkg-config autoconf libtool-bin
displayName: Install cross-compiler
- script: |
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
make
sudo make install
displayName: Install ffnvcodec
- script: |
git clone https://github.com/lu-zero/mfx_dispatch
cd mfx_dispatch
autoreconf -fiv
automake --add-missing
./configure \
--host=$(crossPrefix) \
--enable-shared \
--disable-static \
--prefix=$(Build.ArtifactStagingDirectory)/$(rid)/usr/local/
make
make install
displayName: Install libmfx
- script: |
wget -nv -nc http://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.bz2 -O ffmpeg-$(FFMPEG_VERSION).tar.bz2
tar xjf ffmpeg-$(FFMPEG_VERSION).tar.bz2
displayName: Download FFmpeg
- script: |
# See https://github.com/FFmpeg/FFmpeg/blob/master/configure for an overview of all configuration
# options
PKG_CONFIG_CROSS=$(Build.ArtifactStagingDirectory)/$(rid)/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH=${PKG_CONFIG_CROSS}:${PKG_CONFIG_PATH}
./configure \
--pkg-config=pkg-config \
--arch=$(arch) \
--target-os=$(targetOs) \
--cross-prefix=$(crossPrefix)- \
--disable-static \
--enable-shared \
--enable-version3 \
--enable-cuda \
--enable-cuvid \
--enable-nvenc \
--enable-nvdec \
--enable-dxva2 \
--enable-libmfx
make
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Build FFmpeg
- script: |
make DESTDIR=$(Build.ArtifactStagingDirectory)/$(rid) install
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Install FFmpeg
- script: |
libgcc="/usr/lib/gcc/$(crossPrefix)/7.3-posix/libgcc_s_sjlj-1.dll"
if [ -f "$libgcc" ]; then
echo "$libgcc exist"
cp $libgcc $(Build.ArtifactStagingDirectory)/$(rid)/usr/local/bin/
fi
libstdc="/usr/lib/gcc/$(crossPrefix)/7.3-posix/libstdc++-6.dll"
if [ -f "$libstdc" ]; then
echo "$libstdc exist"
cp $libstdc $(Build.ArtifactStagingDirectory)/$(rid)/usr/local/bin/
fi
libgcc_s_seh="/usr/lib/gcc/$(crossPrefix)/7.3-posix/libgcc_s_seh-1.dll"
if [ -f "$libgcc_s_seh" ]; then
echo "$libgcc_s_seh exist"
cp $libgcc_s_seh $(Build.ArtifactStagingDirectory)/$(rid)/usr/local/bin/
fi
cp /usr/$(crossPrefix)/lib/libwinpthread-1.dll $(Build.ArtifactStagingDirectory)/$(rid)/usr/local/bin/
displayName: Copy additional libraries
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ffmpeg
- job: ubuntu
pool:
# This job builds for the linux-x64 RID. This includes hosts running CentOS 7. Because CentOS 7
# has an old version of glibc, we build on a relatively old version of Ubuntu, which also ships
# with an older version of glibc.
vmImage: ubuntu-20.04
container:
image: ubuntu:16.04
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
steps:
- script: |
/tmp/docker exec -t -u 0 ci-container \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: Set up sudo
- script: |
sudo apt-get install -y build-essential patchelf gcc g++ yasm libunwind8 wget
displayName: Set up patchelf, wget, compiler
- script: |
wget -nv -nc http://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.bz2 -O ffmpeg-$(FFMPEG_VERSION).tar.bz2
tar xjf ffmpeg-$(FFMPEG_VERSION).tar.bz2
displayName: Download FFmpeg
- script: |
# See https://github.com/FFmpeg/FFmpeg/blob/master/configure for an overview of all configuration
# options
./configure --arch=x86_64 --disable-static --enable-shared --enable-version3
make
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Build FFmpeg
- script:
make DESTDIR=$(Build.ArtifactStagingDirectory)/linux-x64 install
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Install FFmpeg
- script: |
for f in $(Build.ArtifactStagingDirectory)/linux-x64/usr/local/lib/*.so.*; do
chmod +w $f
patchelf --set-rpath '${ORIGIN}' $f
readelf -d $f
done
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ffmpeg
- job: macos
pool:
# Use 10.14 to avoid the following error:
# dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
vmImage: 'macOS-10.14'
steps:
- script: |
brew install yasm
displayName: Install YASM
- script: |
wget -nv -nc http://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.bz2 -O ffmpeg-$(FFMPEG_VERSION).tar.bz2
tar xjf ffmpeg-$(FFMPEG_VERSION).tar.bz2
displayName: Download FFmpeg
- script: |
# See https://github.com/FFmpeg/FFmpeg/blob/master/configure for an overview of all configuration
# options
./configure --arch=x86_64 --disable-static --enable-shared --enable-version3
make
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Build FFmpeg
- script: |
make DESTDIR=$(Build.ArtifactStagingDirectory)/osx-x64 install
workingDirectory: ffmpeg-$(FFMPEG_VERSION)
displayName: Install FFmpeg
- script: |
cp /usr/local/opt/xz/lib/liblzma.5.dylib $(Build.ArtifactStagingDirectory)/osx-x64/usr/local/lib
displayName: Copy additional libraries
- script: |
out="$(Build.ArtifactStagingDirectory)/osx-x64/usr/local/lib"
# Patch the dylib dependencies for all .dylib files in the out directory
for f in "$out/"*.dylib; do
chmod +w "$f"
# Skip the first two lines of the otool output, this is just the name of the dylib itself
dylibs=`otool -L "$f" | tail -n +3 | grep "/usr/local/" | awk -F' ' '{ print $1 }'`
for dylib in $dylibs; do
basename=`basename "$dylib"`
if [ ! -f "$out/$basename" ]; then
echo "error: The dylib file '$out/$basename' does not exist in the output folder; referenced from $f"
fi
# https://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-names.html
install_name_tool -change "$dylib" "@loader_path/$basename" "$f"
done;
otool -L "$f"
done
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ffmpeg
- job: nuget
dependsOn:
- windows_cross
- macos
pool:
vmImage: ubuntu-20.04
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: ffmpeg
- script: |
cd FFmpeg.Native
# Run dotnet pack with and without a version suffix
mkdir -p $(Build.ArtifactStagingDirectory)/nuget
dotnet pack -o $(Build.ArtifactStagingDirectory)/nuget -c Release
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget'
artifactName: nuget