diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml new file mode 100644 index 0000000..9f1a343 --- /dev/null +++ b/.github/workflows/linux_build.yml @@ -0,0 +1,110 @@ +name: Linux Build + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths-ignore: + - .github/** + - "!.github/workflows/linux_build.yml" + - "**.md" + - "docs/**" + push: + branches: + - main + paths-ignore: + - .github/** + - "!.github/workflows/linux_build.yml" + - "**.md" + - "docs/**" + +env: + BETTER_MEDIA_INFO_VERSION: 0.2.0 + +jobs: + build_package: + name: Build for Linux x86_64 + runs-on: ubuntu-latest + + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Checkout the code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Upgrade Ubuntu + run: | + sudo apt-get update + sudo apt-get install -y libsoup2.4-dev libwebkit2gtk-4.0-dev librsvg2-dev + + - name: Build zlib + run: | + cd .. + curl -o zlib.tar.gz https://www.zlib.net/zlib-1.3.1.tar.gz + tar -xzvf zlib.tar.gz + mv zlib-1.3.1 zlib + rm zlib.tar.gz + cd zlib + ./configure --static + make -j 4 + + - name: Build ZenLib + run: | + cd .. + git clone https://github.com/MediaArea/ZenLib.git + cd ZenLib/Project/GNU/Library + ./autogen.sh + ./configure --enable-static + make -j 4 + + - name: Build MediaInfoLib + run: | + cd .. + git clone https://github.com/MediaArea/MediaInfoLib.git + cd MediaInfoLib/Project/GNU/Library + ./autogen.sh + ./configure --enable-static + make -j 4 + + - name: Build BetterMediaInfo + run: | + pnpm install + pnpm tauri build + + - name: Upload the deb + uses: actions/upload-artifact@v4 + with: + name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-deb + path: | + src-tauri/target/release/bundle/deb/*.deb + + - name: Upload the rpm + uses: actions/upload-artifact@v4 + with: + name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-rpm + path: | + src-tauri/target/release/bundle/rpm/*.rpm + + - name: Upload the AppImage + uses: actions/upload-artifact@v4 + with: + name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-AppImage + path: | + src-tauri/target/release/bundle/appimage/*.AppImage diff --git a/README.md b/README.md index 3c4a8e7..034157b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # BetterMediaInfo -[![MacOS Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml) [![Windows Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml) +[![Linux Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/linux_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/linux_build.yml) [![MacOS Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml) [![Windows Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml) BetterMediaInfo is a better GUI for [MediaInfo](https://github.com/MediaArea/MediaInfo). Why? Because I'm not a fan of the official MediaInfo GUI. @@ -8,7 +8,7 @@ BetterMediaInfo is built on top of [MediaInfoLib](https://github.com/MediaArea/M ## Features -* MacOS (x86_64 + arm64) + Windows (x86_64) +* Linux (x86_64) + MacOS (x86_64 + arm64) + Windows (x86_64) * Drag and drop * Multiple files / directories * Real-time filter diff --git a/docs/development.md b/docs/development.md index 62db3dd..5efe01b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -10,6 +10,50 @@ git clone https://github.com/MediaArea/MediaInfoLib.git git clone https://github.com/MediaArea/ZenLib.git ``` +### Build MediaInfoLib for Linux + +* Upgrade Ubuntu. + +```sh +sudo apt-get update +sudo apt-get install -y libsoup2.4-dev libwebkit2gtk-4.0-dev librsvg2-dev +``` + +* Download zlib. + +```sh +curl -o zlib.tar.gz https://www.zlib.net/zlib-1.3.1.tar.gz +tar -xzvf zlib.tar.gz +mv zlib-1.3.1 zlib +rm zlib.tar.gz +``` + +* Build zlib. + +```sh +cd zlib +./configure --static +make -j`nproc` +``` + +* Build ZenLib. + +```sh +cd ZenLib/Project/GNU/Library +./autogen.sh +./configure --enable-static +make -j`nproc` +``` + +* Build MediaInfoLib. + +```sh +cd MediaInfoLib/Project/GNU/Library +./autogen.sh +./configure --enable-static +make -j`nproc` +``` + ### Build MediaInfoLib for MacOS * Install XCode. diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 165ae9f..2c069c2 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -89,7 +89,7 @@ fn main() { let better_media_info_path = Path::new(cargo_manifest_dir.as_str()); let root_path = better_media_info_path.parent().unwrap().parent().unwrap(); - #[cfg(target_os = "macos")] + #[cfg(not(target_os = "windows"))] { let z_lib = ExternalLib { is_static: true, @@ -106,11 +106,15 @@ fn main() { source_path: "ZenLib/Project/GNU/Library/.libs".to_owned(), }; zen_lib.link(root_path); - - println!("cargo:rustc-link-lib=c++"); } + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=libc++"); + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-lib=c++"); + + #[cfg(not(target_os = "windows"))] let media_info_lib = ExternalLib { is_static: true, file_name: "libmediainfo.a".to_owned(), diff --git a/src-tauri/src/media_info.rs b/src-tauri/src/media_info.rs index f13bb8b..b069b83 100644 --- a/src-tauri/src/media_info.rs +++ b/src-tauri/src/media_info.rs @@ -37,7 +37,7 @@ type mi_kind = raw::c_int; type mi_void = raw::c_void; #[cfg(target_os = "windows")] type mi_wchar = u16; -#[cfg(target_os = "macos")] +#[cfg(not(target_os = "windows"))] type mi_wchar = u32; const DEFAULT_OPTION_VALUE: &str = "";