Skip to content

Commit 7c9f6b8

Browse files
committed
add static build test in macos
1 parent f6daf0d commit 7c9f6b8

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
build-linux:
12-
name: native build in linux
12+
name: build in native linux
1313
runs-on: ubuntu-20.04
1414
steps:
1515
- name: Checkout code
@@ -31,7 +31,7 @@ jobs:
3131
./build-ffmpeg --cleanup
3232
3333
build-macos:
34-
name: native build in macos
34+
name: build in native macOS
3535
runs-on: macos-10.15
3636
steps:
3737
- name: Checkout code
@@ -52,6 +52,28 @@ jobs:
5252
run: |
5353
./build-ffmpeg --cleanup
5454
55+
build-macos-static:
56+
name: full static build in native macOS
57+
runs-on: macos-10.15
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v2
61+
62+
- name: build ffmpeg
63+
run: |
64+
while sleep 300; do echo "=====[ $SECONDS seconds still running ]====="; done &
65+
SKIPINSTALL=yes VERBOSE=yes ./build-ffmpeg --build --full-static
66+
kill %1
67+
- name: check shared library
68+
run: |
69+
otool -L ./workspace/bin/ffmpeg
70+
- name: test run ffmepg
71+
run: |
72+
./workspace/bin/ffmpeg -buildconf
73+
- name: clean up
74+
run: |
75+
./build-ffmpeg --cleanup
76+
5577
build-docker:
5678
name: build in docker
5779
runs-on: ubuntu-20.04
@@ -99,7 +121,7 @@ jobs:
99121
docker run --rm ffmpeg:cuda -buildconf
100122
101123
build-full-static:
102-
name: build full static linking in docker
124+
name: build full static in docker
103125
runs-on: ubuntu-20.04
104126
steps:
105127
- name: Checkout code

build-ffmpeg

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ WORKSPACE="$CWD/workspace"
1010
CFLAGS="-I$WORKSPACE/include"
1111
LDFLAGS="-L$WORKSPACE/lib"
1212
LDEXEFLAGS=""
13-
EXTRALIBS="-ldl -lpthread -lm -lz"
13+
EXTRALIBS="-Wl,-Bdynamic,-lc,-ldl,-lpthread,-lm,-Bstatic,-lz,-lbz2,-llzma"
1414
CONFIGURE_OPTIONS=()
1515

1616
# Speed up the process
@@ -175,6 +175,9 @@ while (( $# > 0 )); do
175175
fi
176176
if [[ "$1" == "--full-static" || "$1" =~ 'f' ]]; then
177177
LDEXEFLAGS="-static"
178+
if [[ "$OSTYPE" == "darwin"* ]]; then
179+
LDEXEFLAGS="-Bstatic"
180+
fi
178181
fi
179182
shift
180183
;;
@@ -370,16 +373,12 @@ CONFIGURE_OPTIONS+=("--enable-libx264")
370373
if build "x265"; then
371374
download "https://github.com/videolan/x265/archive/Release_3.5.tar.gz" "x265-3.5.tar.gz"
372375
cd build/linux || exit
376+
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DENABLE_SHARED=off -DBUILD_SHARED_LIBS=OFF ../../source
377+
execute make -j $MJOBS
378+
execute make install
373379

374380
if [ -n "$LDEXEFLAGS" ]; then
375-
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DENABLE_SHARED=off -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK_CRT=ON ../../source
376-
execute make -j $MJOBS
377-
execute make install
378381
sed -i.backup 's/-lgcc_s/-lgcc_eh/g' "${WORKSPACE}/lib/pkgconfig/x265.pc" # The -i.backup is intended and required on MacOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
379-
else
380-
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DENABLE_SHARED=off -DBUILD_SHARED_LIBS=OFF ../../source
381-
execute make -j $MJOBS
382-
execute make install
383382
fi
384383

385384
build_done "x265"

0 commit comments

Comments
 (0)