Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Re-implement Zalo for Linux Native Libraries 🛠️

This repository contains the Rust re-implement source code from C decompile code with Ghidar and build orchestrator to compile and package the native Node.js addons for the Zalo for Linux client.

🔴 Status

  • db-cross-v4: working, C++ addon, thanks for realdtn2's RE db-cross-v4 (realdtn2/zalo-linux-2026)
  • file-utilities: working (need to refresh in Storage Management Settings after patch)
  • file-utils: working
  • logger: working (native support, pure JS module)
  • mp4thumb: working, testing
  • sqlite3: working (add native Linux libs to Zalo's nativelibs)
  • v8-profiles: Not planned or later
  • zcall: Not planned or later (requires ZaloCall from the Qt ZaloHelper Process)
  • zfile: Not needed (Only Windows needs this nativelib)
  • zimage: working
  • zjxl: working
  • zwalker: Planned

📋 Prerequisites & Dependency Packages

🔴 Debian / Ubuntu (apt)

# Install core build tools, nodejs & rust
sudo apt update
sudo apt install -y build-essential python3 pkg-config rustc cargo nodejs npm

# Install library development headers
sudo apt install -y \
  libssl-dev \
  liblzma-dev \
  libbz2-dev \
  zlib1g-dev \
  libavcodec-dev \
  libavformat-dev \
  libswscale-dev \
  libavutil-dev

🔵 Fedora (dnf)

# Install core build tools, nodejs & rust
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y python3 pkgconf-pkg-config rust cargo nodejs npm

# Install library development headers
sudo dnf install -y \
  openssl-devel \
  xz-devel \
  bzip2-devel \
  zlib-devel \
  ffmpeg-free-devel

🟢 Arch Linux (pacman)

# Install core build tools, nodejs & rust
sudo pacman -Syu --needed base-devel python rust nodejs npm

# Install library dependencies
sudo pacman -S --needed \
  openssl \
  xz \
  bzip2 \
  zlib \
  ffmpeg

🏃 Build

Do not perform steps 2, 3, and 4 if skipping the js patch (Add Linux support to the original loader js)

1. Clean Up Build Artifacts

Deletes all build/, target/, and node_modules/ folders, as well as temporary .node and generated test files in all subdirectories:

npm run clean

2. Download Zalo for macOS .dmg file and move to this directory repository

3. Extract the Zalo .dmg file

7z x Zalo_*.dmg -o temp/Zalo_macOS

4. Copy original macOS nativelibs

cp -r temp/Zalo_macOS/Zalo.app/Contents/Resources/app.asar.unpacked/native/nativelibs nativelibs-macOS

5. Compile and Package

Installs dependencies for the build script and orchestrates compiling and packing of all submodules:

npm install
npm run build

With skipping js patch, run npm run build:skip-patch instead of npm run build.

Once the process completes, the structured distribution-ready native addons will be located in the destination folder. The default destination folder is nativelibs, the custom destination folder path can be set with DEST_DIR environment.

With clean rebuild, run npm run build:clean (This is equivalent to running npm run clean and node run build sequentially) or run npm run build:clean:skip-patch with skipping js patch


⚙️ How It Works

Re-implement nativelibs to Linux from macOS x64

1. Decompile macOS x64 nativelibs with Ghidra and export decompiled C code

2. Clean-room re-implement with Rust

Build Process

The orchestration script performs the following automated steps upon running npm run build:

  1. Compilation:
    • Runs cargo build --release to build Rust modules.
  2. Live JS Wrapper Patching:
    • patch-js-helper.js reads the original macOS JS wrappers from the nativelibs-macOS folder.
    • Modifies them in-memory to inject process.platform === 'linux' switches and correct relative .node paths before saving them to the destination. This eliminates the need to maintain static pre-patched wrapper files.

LICENSE

This repository contains only original Rust source code and scripts written from scratch. It does not distribute any proprietary binaries, assets, or original dynamic libraries.

This project is an independent re-implementation, unofficial port of the native libraries. It is not affiliated with, endorsed by, or sponsored by Zalo or VNG Corporation. "Zalo" is a trademark of VNG Corporation.

This software is provided for educational and research purposes. Users are solely responsible for complying with applicable local laws and the platform Terms of Service.

About

Re-impl Zalo for Linux Native Libraries

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages