@@ -131,202 +131,189 @@ jobs:
131131 uses : softprops/action-gh-release@v1
132132 if : startsWith(github.ref, 'refs/tags/')
133133 with :
134- files : ./build/ OpenConverter_Linux_x86.tar.gz
134+ files : OpenConverter_Linux_x86.tar.gz
135135
136136 - name : Finish
137137 run : echo "Linux X86 Release upload complete"
138138
139139 build-mac-arm :
140140 runs-on : macos-latest
141141
142- steps :
143- - name : Checkout target branch code (using pull_request_target)
144- uses : actions/checkout@v2
145- with :
146- ref : ${{ github.event.pull_request.head.ref }}
147-
148- - name : Fetch and checkout PR branch
149- run : |
150- git remote add pr_origin https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git
151- git fetch pr_origin ${{ github.event.pull_request.head.ref }}:pr_branch
152- git checkout pr_branch
153-
154- - name : Print current branch and commit hash
155- run : |
156- echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
157- echo "Current commit hash: $(git rev-parse HEAD)"
158-
159- - name : Checkout BMF repository(specific branch)
160- run : |
161- brew install make git pkg-config openssl cmake glog x264 x265
162- # export FFMPEG_ROOT_PATH=$(brew --prefix ffmpeg@5)
163- # echo "FFMPEG_ROOT_PATH=$FFMPEG_ROOT_PATH" >> $GITHUB_ENV
164-
165- git clone https://github.com/JackLau1222/bmf.git
166-
167- wget https://invisible-island.net/archives/ncurses/ncurses-6.5.tar.gz
168- wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.bz2
169-
170- - name : Cache ncurses build
171- uses : actions/cache@v3
172- with :
173- path : opt/ncurses
174- key : ${{ runner.os }}-ncurses-${{ hashFiles('ncurses-6.5.tar.gz') }}
175- restore-keys : |
176- ${{ runner.os }}-ncurses-
177-
178- - name : Cache binutils build
179- uses : actions/cache@v3
180- with :
181- path : opt/binutils
182- key : ${{ runner.os }}-binutils-${{ hashFiles('binutils-2.43.1.tar.bz2') }}
183- restore-keys : |
184- ${{ runner.os }}-binutils-
185-
186- - name : compile dependencies
187- run : |
188- if [ ! -d "$(pwd)/opt/ncurses" ]; then
189- tar -xzvf ncurses-6.5.tar.gz
190- (cd ncurses-6.5 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/ncurses && make -j$(sysctl -n hw.ncpu) && sudo make install)
191- else
192- echo "ncurses is already installed, skipping build."
193- fi
194-
195- if [ ! -d "$(pwd)/opt/binutils" ]; then
196- tar xvf binutils-2.43.1.tar.bz2
197- (cd binutils-2.43.1 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/binutils --enable-install-libiberty && make -j$(sysctl -n hw.ncpu) && sudo make install)
198- else
199- echo "binutils is already installed, skipping build."
200- fi
201-
202- - name : Cache FFmpeg build
203- uses : actions/cache@v3
204- with :
205- path : |
206- ffmpeg
207- key : ${{ runner.os }}-ffmpeg-${{ hashFiles('bmf/scripts/build_ffmpeg.sh') }}
208- restore-keys : |
209- ${{ runner.os }}-ffmpeg-macos-arm-
210-
211- - name : Cache BMF build
212- uses : actions/cache@v3
213- with :
214- path : bmf/output/
215- key : ${{ runner.os }}-bmf-${{ hashFiles('bmf/build.sh') }}
216- restore-keys : |
217- ${{ runner.os }}-bmf-macos-arm-
218-
219- - name : Compile FFmpeg if not cached
220- run : |
221- if [ ! -d "$(pwd)/ffmpeg" ]; then
222- echo "FFmpeg not found, starting build..."
223- wget https://ffmpeg.org/releases/ffmpeg-5.1.6.tar.bz2 && tar xjvf ffmpeg-5.1.6.tar.bz2
224- (cd ffmpeg-5.1.6 && ./configure --pkg-config-flags=--static --enable-shared --disable-static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-nonfree --enable-libx264 --enable-libx265 --prefix=../ffmpeg)
225- (cd ffmpeg-5.1.6 && make -j$(sysctl -n hw.ncpu) && make install)
226- else
227- echo "FFmpeg is already installed, skipping build."
228- fi
229- echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg" >> $GITHUB_ENV
230-
231- - name : Set up BMF if not cached
232- run : |
233- if [ ! -d "$(pwd)/bmf/output/" ]; then
234- export LIBRARY_PATH=$(pwd)/opt/binutils/lib:$LIBRARY_PATH
235- export CMAKE_PREFIX_PATH=$(pwd)/opt/binutils:$CMAKE_PREFIX_PATH
236- pip install setuptools
237- (cd bmf && git checkout fork_by_oc && git submodule update --init --recursive && ./build_osx.sh)
238- else
239- echo "BMF is already installed, skipping build."
240- fi
241- echo "BMF_ROOT_PATH=$(pwd)/bmf/output/bmf" >> $GITHUB_ENV
242-
243- - name : Set up Qt
244- run : |
245- brew install qt5
246-
247- - name : Build with CMake
248- run : |
249- export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
250- export CMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5:$CMAKE_PREFIX_PATH"
251- export QT_DIR="/opt/homebrew/opt/qt@5/lib/cmake/Qt5"
252- export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
253- (cd src && cmake -B build && cd build && make -j$(sysctl -n hw.ncpu))
254-
255- export DYLD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
256- export LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
257-
258- # fix link libraries path mistake
259- cd src/build
260- macdeployqt OpenConverter.app
261-
262- FFMPEG_LIB_DIR="$FFMPEG_ROOT_PATH/lib"
263- APP_DIR="OpenConverter.app"
264- FRAMEWORK_DIR="$APP_DIR/Contents/Frameworks"
265- cp $FFMPEG_LIB_DIR/*.dylib $FRAMEWORK_DIR/
266-
267- FFMPEG_LIBS=$(find "$FFMPEG_LIB_DIR" -name "*.dylib")
268-
269- for lib in $FFMPEG_LIBS; do
270- lib_name=$(basename "$lib")
271- target_lib="$FRAMEWORK_DIR/$lib_name"
272-
273- if [ -f "$target_lib" ]; then
274- echo "Processing $target_lib"
275- deps=$(otool -L "$target_lib" | grep -E '\.dylib' | awk '{print $1}')
276- for dep in $deps; do
277- if [[ $dep == *ffmpeg* ]]; then
278- new_dep="@executable_path/../Frameworks/$(basename "$dep")"
279- echo "Updating dependency $dep to $new_dep in $target_lib"
280- install_name_tool -change "$dep" "$new_dep" "$target_lib"
281- fi
282- done
283- else
284- echo "Library $lib_name not found in $FRAMEWORK_DIR"
285- fi
286- done
287- echo "Finished fixing library paths!"
288-
289- install_name_tool -change ../ffmpeg/lib/libavformat.59.dylib @executable_path/../Frameworks/libavformat.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
290- install_name_tool -change ../ffmpeg/lib/libavcodec.59.dylib @executable_path/../Frameworks/libavcodec.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
291- install_name_tool -change ../ffmpeg/lib/libavutil.57.dylib @executable_path/../Frameworks/libavutil.57.dylib OpenConverter.app/Contents/MacOS/OpenConverter
292- install_name_tool -change ../ffmpeg/lib/libswresample.4.dylib @executable_path/../Frameworks/libswresample.4.dylib OpenConverter.app/Contents/MacOS/OpenConverter
293- install_name_tool -change ../ffmpeg/lib/libswscale.6.dylib @executable_path/../Frameworks/libswscale.6.dylib OpenConverter.app/Contents/MacOS/OpenConverter
294- install_name_tool -change ../ffmpeg/lib/libavfilter.8.dylib @executable_path/../Frameworks/libavfilter.8.dylib OpenConverter.app/Contents/MacOS/OpenConverter
295- install_name_tool -change ../ffmpeg/lib/libavdevice.59.dylib @executable_path/../Frameworks/libavdevice.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
296- install_name_tool -change ../ffmpeg/lib/libpostproc.56.dylib @executable_path/../Frameworks/libpostproc.56.dylib OpenConverter.app/Contents/MacOS/OpenConverter
297-
298- cd ../..
299-
300- (cd src/build &&
301- cp $BMF_ROOT_PATH/BUILTIN_CONFIG.json OpenConverter.app/Contents/Frameworks &&
302- mkdir OpenConverter.app/Contents/Frameworks/lib && cp $BMF_ROOT_PATH/lib/libbuiltin_modules.dylib OpenConverter.app/Contents/Frameworks/lib &&
303- macdeployqt OpenConverter.app -dmg)
304-
305- mv src/build/OpenConverter.dmg OpenConverter_macOS_aarch64.dmg
306-
307- # Step to upload the dmg package as an artifact
308- - name : Upload build artifact
309- uses : actions/upload-artifact@v3
310- with :
311- name : OpenConverter_macOS_aarch64
312- path : OpenConverter_macOS_aarch64.dmg
313-
314- - name : Get GitHub Release information
315- id : release_info
316- run : echo "::set-output name=release_tag::$(echo ${GITHUB_REF#refs/tags/})"
317-
318- - name : Upload Release Asset
319- uses : softprops/action-gh-release@v1
320- if : startsWith(github.ref, 'refs/tags/')
321- with :
322- files : OpenConverter_macOS_aarch64.dmg
323-
324- - name : Finish
325- run : echo "macOS aarch64 Release upload complete"
326-
327- - name : Setup tmate session
328- if : ${{ failure() }}
329- uses : mxschmitt/action-tmate@v3
330-
331- - name : Finish
332- run : echo "Release upload complete"
142+ steps :
143+ - name : Checkout target branch code (using pull_request_target)
144+ uses : actions/checkout@v2
145+
146+ - name : Checkout BMF repository(specific branch)
147+ run : |
148+ brew install make git pkg-config openssl cmake glog x264 x265
149+ # export FFMPEG_ROOT_PATH=$(brew --prefix ffmpeg@5)
150+ # echo "FFMPEG_ROOT_PATH=$FFMPEG_ROOT_PATH" >> $GITHUB_ENV
151+
152+ git clone https://github.com/JackLau1222/bmf.git
153+
154+ wget https://invisible-island.net/archives/ncurses/ncurses-6.5.tar.gz
155+ wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.bz2
156+
157+ - name : Cache ncurses build
158+ uses : actions/cache@v3
159+ with :
160+ path : opt/ncurses
161+ key : ${{ runner.os }}-ncurses-${{ hashFiles('ncurses-6.5.tar.gz') }}
162+ restore-keys : |
163+ ${{ runner.os }}-ncurses-
164+
165+ - name : Cache binutils build
166+ uses : actions/cache@v3
167+ with :
168+ path : opt/binutils
169+ key : ${{ runner.os }}-binutils-${{ hashFiles('binutils-2.43.1.tar.bz2') }}
170+ restore-keys : |
171+ ${{ runner.os }}-binutils-
172+
173+ - name : compile dependencies
174+ run : |
175+ if [ ! -d "$(pwd)/opt/ncurses" ]; then
176+ tar -xzvf ncurses-6.5.tar.gz
177+ (cd ncurses-6.5 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/ncurses && make -j$(sysctl -n hw.ncpu) && sudo make install)
178+ else
179+ echo "ncurses is already installed, skipping build."
180+ fi
181+
182+ if [ ! -d "$(pwd)/opt/binutils" ]; then
183+ tar xvf binutils-2.43.1.tar.bz2
184+ (cd binutils-2.43.1 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/binutils --enable-install-libiberty && make -j$(sysctl -n hw.ncpu) && sudo make install)
185+ else
186+ echo "binutils is already installed, skipping build."
187+ fi
188+
189+ - name : Cache FFmpeg build
190+ uses : actions/cache@v3
191+ with :
192+ path : |
193+ ffmpeg
194+ key : ${{ runner.os }}-ffmpeg-${{ hashFiles('bmf/scripts/build_ffmpeg.sh') }}
195+ restore-keys : |
196+ ${{ runner.os }}-ffmpeg-macos-arm-
197+
198+ - name : Cache BMF build
199+ uses : actions/cache@v3
200+ with :
201+ path : bmf/output/
202+ key : ${{ runner.os }}-bmf-${{ hashFiles('bmf/build.sh') }}
203+ restore-keys : |
204+ ${{ runner.os }}-bmf-macos-arm-
205+
206+ - name : Compile FFmpeg if not cached
207+ run : |
208+ if [ ! -d "$(pwd)/ffmpeg" ]; then
209+ echo "FFmpeg not found, starting build..."
210+ wget https://ffmpeg.org/releases/ffmpeg-5.1.6.tar.bz2 && tar xjvf ffmpeg-5.1.6.tar.bz2
211+ (cd ffmpeg-5.1.6 && ./configure --pkg-config-flags=--static --enable-shared --disable-static --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-nonfree --enable-libx264 --enable-libx265 --prefix=../ffmpeg)
212+ (cd ffmpeg-5.1.6 && make -j$(sysctl -n hw.ncpu) && make install)
213+ else
214+ echo "FFmpeg is already installed, skipping build."
215+ fi
216+ echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg" >> $GITHUB_ENV
217+
218+ - name : Set up BMF if not cached
219+ run : |
220+ if [ ! -d "$(pwd)/bmf/output/" ]; then
221+ export LIBRARY_PATH=$(pwd)/opt/binutils/lib:$LIBRARY_PATH
222+ export CMAKE_PREFIX_PATH=$(pwd)/opt/binutils:$CMAKE_PREFIX_PATH
223+ pip install setuptools
224+ (cd bmf && git checkout fork_by_oc && git submodule update --init --recursive && ./build_osx.sh)
225+ else
226+ echo "BMF is already installed, skipping build."
227+ fi
228+ echo "BMF_ROOT_PATH=$(pwd)/bmf/output/bmf" >> $GITHUB_ENV
229+
230+ - name : Set up Qt
231+ run : |
232+ brew install qt5
233+
234+ - name : Build with CMake
235+ run : |
236+ export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
237+ export CMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5:$CMAKE_PREFIX_PATH"
238+ export QT_DIR="/opt/homebrew/opt/qt@5/lib/cmake/Qt5"
239+ export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
240+ (cd src && cmake -B build && cd build && make -j$(sysctl -n hw.ncpu))
241+
242+ export DYLD_LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
243+ export LIBRARY_PATH=$FFMPEG_ROOT_PATH/lib/:$BMF_ROOT_PATH/lib
244+
245+ # fix link libraries path mistake
246+ cd src/build
247+ macdeployqt OpenConverter.app
248+
249+ FFMPEG_LIB_DIR="$FFMPEG_ROOT_PATH/lib"
250+ APP_DIR="OpenConverter.app"
251+ FRAMEWORK_DIR="$APP_DIR/Contents/Frameworks"
252+ cp $FFMPEG_LIB_DIR/*.dylib $FRAMEWORK_DIR/
253+
254+ FFMPEG_LIBS=$(find "$FFMPEG_LIB_DIR" -name "*.dylib")
255+
256+ for lib in $FFMPEG_LIBS; do
257+ lib_name=$(basename "$lib")
258+ target_lib="$FRAMEWORK_DIR/$lib_name"
259+
260+ if [ -f "$target_lib" ]; then
261+ echo "Processing $target_lib"
262+ deps=$(otool -L "$target_lib" | grep -E '\.dylib' | awk '{print $1}')
263+ for dep in $deps; do
264+ if [[ $dep == *ffmpeg* ]]; then
265+ new_dep="@executable_path/../Frameworks/$(basename "$dep")"
266+ echo "Updating dependency $dep to $new_dep in $target_lib"
267+ install_name_tool -change "$dep" "$new_dep" "$target_lib"
268+ fi
269+ done
270+ else
271+ echo "Library $lib_name not found in $FRAMEWORK_DIR"
272+ fi
273+ done
274+ echo "Finished fixing library paths!"
275+
276+ install_name_tool -change ../ffmpeg/lib/libavformat.59.dylib @executable_path/../Frameworks/libavformat.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
277+ install_name_tool -change ../ffmpeg/lib/libavcodec.59.dylib @executable_path/../Frameworks/libavcodec.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
278+ install_name_tool -change ../ffmpeg/lib/libavutil.57.dylib @executable_path/../Frameworks/libavutil.57.dylib OpenConverter.app/Contents/MacOS/OpenConverter
279+ install_name_tool -change ../ffmpeg/lib/libswresample.4.dylib @executable_path/../Frameworks/libswresample.4.dylib OpenConverter.app/Contents/MacOS/OpenConverter
280+ install_name_tool -change ../ffmpeg/lib/libswscale.6.dylib @executable_path/../Frameworks/libswscale.6.dylib OpenConverter.app/Contents/MacOS/OpenConverter
281+ install_name_tool -change ../ffmpeg/lib/libavfilter.8.dylib @executable_path/../Frameworks/libavfilter.8.dylib OpenConverter.app/Contents/MacOS/OpenConverter
282+ install_name_tool -change ../ffmpeg/lib/libavdevice.59.dylib @executable_path/../Frameworks/libavdevice.59.dylib OpenConverter.app/Contents/MacOS/OpenConverter
283+ install_name_tool -change ../ffmpeg/lib/libpostproc.56.dylib @executable_path/../Frameworks/libpostproc.56.dylib OpenConverter.app/Contents/MacOS/OpenConverter
284+
285+ cd ../..
286+
287+ (cd src/build &&
288+ cp $BMF_ROOT_PATH/BUILTIN_CONFIG.json OpenConverter.app/Contents/Frameworks &&
289+ mkdir OpenConverter.app/Contents/Frameworks/lib && cp $BMF_ROOT_PATH/lib/libbuiltin_modules.dylib OpenConverter.app/Contents/Frameworks/lib &&
290+ macdeployqt OpenConverter.app -dmg)
291+
292+ mv src/build/OpenConverter.dmg OpenConverter_macOS_aarch64.dmg
293+
294+ # Step to upload the dmg package as an artifact
295+ - name : Upload build artifact
296+ uses : actions/upload-artifact@v3
297+ with :
298+ name : OpenConverter_macOS_aarch64
299+ path : OpenConverter_macOS_aarch64.dmg
300+
301+ - name : Get GitHub Release information
302+ id : release_info
303+ run : echo "::set-output name=release_tag::$(echo ${GITHUB_REF#refs/tags/})"
304+
305+ - name : Upload Release Asset
306+ uses : softprops/action-gh-release@v1
307+ if : startsWith(github.ref, 'refs/tags/')
308+ with :
309+ files : OpenConverter_macOS_aarch64.dmg
310+
311+ - name : Finish
312+ run : echo "macOS aarch64 Release upload complete"
313+
314+ - name : Setup tmate session
315+ if : ${{ failure() }}
316+ uses : mxschmitt/action-tmate@v3
317+
318+ - name : Finish
319+ run : echo "Release upload complete"
0 commit comments