文件
mynode/packages/tools/gulp/tasks/compileExtensions.js
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

56 行
1.8 KiB
JavaScript

const fs = require('fs-extra');
const utils = require('../utils');
async function getSourceCode(dest) {
await utils.execCommand(`curl -o ${dest}/sqlite.tar.gz "https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release"`);
await utils.execCommand(`curl -o ${dest}/amalgamation.tar.gz "https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz"`);
await utils.execCommand(`tar -xzvf ${dest}/sqlite.tar.gz -C ${dest}`);
await utils.execCommand(`tar -xzvf ${dest}/amalgamation.tar.gz -C ${dest}`);
}
async function main() {
const rootDir = utils.rootDir();
const dest = `${rootDir}/packages/app-mobile/lib/sql-extensions`;
try {
await fs.ensureDir(dest);
if (utils.isLinux()) {
try {
await fs.promises.access(`${dest}/spellfix.so`);
} catch (e) {
await getSourceCode(dest);
await utils.execCommand(`gcc -shared -fPIC -Wall -I${dest}/sqlite-autoconf-3330000/ ${dest}/sqlite/ext/misc/spellfix.c -o ${dest}/spellfix.so`);
}
}
if (utils.isMac()) {
try {
await fs.promises.access(`${dest}/spellfix.dylib`);
} catch (e) {
await getSourceCode(dest);
await utils.execCommand(`gcc -shared -fPIC -Wall -I${dest}/sqlite-autoconf-3330000/ -dynamiclib ${dest}/sqlite/ext/misc/spellfix.c -o ${dest}/spellfix.dylib`);
}
}
// if (utils.isWindows()) {
// try {
// await fs.promises.access(`${dest}/spellfix.dll`);
// } catch (e) {
// await getSourceCode(dest);
// await utils.execCommand(`cl /I ${dest}/sqlite-autoconf-3330000 ${dest}/sqlite/ext/misc/spellfix.c -link -dll -out:spellfix.dll `)
// }
// }
} catch (e) {
console.warn(e);
}
await fs.remove(`${dest}/sqlite.tar.gz`);
await fs.remove(`${dest}/amalgamation.tar.gz`);
await fs.remove(`${dest}/sqlite`);
await fs.remove(`${dest}/sqlite-autoconf-3330000`);
}
module.exports = main;