Skip to content

Commit

Permalink
Working linux prebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Srikanth Kotagiri committed Jul 11, 2024
1 parent 1bf57f2 commit 041b73e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
shell: bash
run: |
apt update
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests -y git git-lfs libxcb1 unzip nodejs curl nodejs npm
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests -y python3-setuptools build-essential
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests -y git git-lfs \
libxcb1 unzip nodejs curl nodejs npm python3-setuptools build-essential
- uses: actions/checkout@v2
with:
Expand All @@ -34,9 +34,6 @@ jobs:
- name: prebuild for Linux (x64)
run: npx prebuild --runtime napi --arch x64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}

# - name: prebuild for Linux (arm64)
# run: npx prebuild --runtime napi --arch arm64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}

windows-package:
permissions:
contents: write
Expand Down
15 changes: 14 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,21 @@
],

"link_settings": {
"ldflags": [
"--verbose"
],
"libraries": [
"-L<(module_root_dir)/ffmpeg/ffmpeg-ffprobe-shared-linux-<(target_arch_override).<(ffmpeg_version)/"
"-Wl,-rpath,./build/Release/ "
"-L<(module_root_dir)/ffmpeg/ffmpeg-ffprobe-shared-linux-<(target_arch_override).<(ffmpeg_version)/ "
"-lavcodec",
"-lavdevice",
"-lavfilter",
"-lavformat",
"-lavutil",
"-lpostproc",
"-lswresample",
"-lswscale",
"-lzimg"
]
},
"copies": [
Expand Down
17 changes: 11 additions & 6 deletions install_ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,31 @@ async function linux() {
const tag = `v${version}`;

await access(`ffmpeg/${ffmpegFilename}`, fs.constants.R_OK).catch(async () => {
const ws = fs.createWriteStream(`ffmpeg/${ffmpegFilename}.zip`);
const url = `https://github.com/descriptinc/ffmpeg-build-script/releases/download/${tag}/${ffmpegFilename}.zip`
const ws = fs.createWriteStream(`ffmpeg/${ffmpegFilename}.tar.gz`);
const url = `https://github.com/descriptinc/ffmpeg-build-script/releases/download/${tag}/${ffmpegFilename}.tar.gz`
console.log(url);
await get(
ws,
url,
`${ffmpegFilename}.zip`
`${ffmpegFilename}.tar.gz`
).catch(async (err) => {
if (err.name === 'RedirectError') {
const redirectURL = err.message;
await get(ws, redirectURL, `${ffmpegFilename}.zip`);
await get(ws, redirectURL, `${ffmpegFilename}.tar.gz`);
} else {
console.error(err);
throw err;
}
});

await exec(`unzip ffmpeg/${ffmpegFilename}.zip -d ffmpeg/${ffmpegFilename}/`);
await mkdir(`ffmpeg/${ffmpegFilename}`).catch(e => {
if (e.code === 'EEXIST') return;
else throw e;
});

await exec(`tar xvzf ffmpeg/${ffmpegFilename}.tar.gz -C ffmpeg/${ffmpegFilename}/`);

console.log('Adding path "$PWD/ffmpeg/${ffmpegFilename}/" to ldconfig path');
console.log(`Adding path "$PWD/ffmpeg/${ffmpegFilename}/" to ldconfig path`);
await exec(`echo "$PWD/ffmpeg/${ffmpegFilename}/" | tee -a /etc/ld.so.conf.d/ffmpeg.conf`)
console.log('Running LDCONFIG');
await exec(`ldconfig`)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 041b73e

Please sign in to comment.