mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Merge pull request #22 from vector-im/dbkr/hak_linux
Build seshat on Linux
This commit is contained in:
commit
da5a0e63ec
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@
|
||||
/pkg/control
|
||||
/.hak
|
||||
/.yarnrc
|
||||
/docker
|
||||
|
12
README
12
README
@ -59,9 +59,21 @@ This will do a couple of things:
|
||||
* Run electron-builder to build a package. The package built will match the operating system
|
||||
you're running the build process on.
|
||||
|
||||
If you'd like to build the native modules (for searching in encrypted rooms):
|
||||
This will take 10 minutes or so, and will require a number of native tools
|
||||
to be installed, depending on your OS (eg. rust, tcl, make/nmake).
|
||||
```
|
||||
yarn run build:native
|
||||
```
|
||||
|
||||
You can also build using docker, which will always produce the linux package:
|
||||
```
|
||||
# Run this once to make the docker image
|
||||
yarn run docker:setup
|
||||
|
||||
yarn run docker:install
|
||||
# if you want to build the native modules (this will take a while)
|
||||
yarn run docker:buildnative
|
||||
yarn run docker:build
|
||||
```
|
||||
|
||||
|
10
dockerbuild/Dockerfile
Normal file
10
dockerbuild/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM electronuserland/builder:12
|
||||
|
||||
ENV RUSTUP_HOME=/usr/local/rustup \
|
||||
CARGO_HOME=/usr/local/cargo \
|
||||
PATH=/usr/local/cargo/bin:$PATH
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libsqlcipher-dev && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal
|
@ -24,7 +24,7 @@ module.exports = async function(hakEnv, moduleInfo) {
|
||||
if (hakEnv.isWin()) {
|
||||
await buildOpenSslWin(hakEnv, moduleInfo);
|
||||
await buildSqlCipherWin(hakEnv, moduleInfo);
|
||||
} else {
|
||||
} else if (hakEnv.isMac()) {
|
||||
await buildSqlCipherUnix(hakEnv, moduleInfo);
|
||||
}
|
||||
await buildMatrixSeshat(hakEnv, moduleInfo);
|
||||
@ -228,11 +228,15 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) {
|
||||
}
|
||||
|
||||
async function buildMatrixSeshat(hakEnv, moduleInfo) {
|
||||
const env = Object.assign({
|
||||
SQLCIPHER_STATIC: 1,
|
||||
SQLCIPHER_LIB_DIR: path.join(moduleInfo.depPrefix, 'lib'),
|
||||
SQLCIPHER_INCLUDE_DIR: path.join(moduleInfo.depPrefix, 'include'),
|
||||
}, hakEnv.makeGypEnv());
|
||||
const env = hakEnv.makeGypEnv();
|
||||
|
||||
if (!hakEnv.isLinux()) {
|
||||
Object.assign(env, {
|
||||
SQLCIPHER_STATIC: 1,
|
||||
SQLCIPHER_LIB_DIR: path.join(moduleInfo.depPrefix, 'lib'),
|
||||
SQLCIPHER_INCLUDE_DIR: path.join(moduleInfo.depPrefix, 'include'),
|
||||
});
|
||||
}
|
||||
|
||||
if (hakEnv.isWin()) {
|
||||
env.RUSTFLAGS = '-Ctarget-feature=+crt-static -Clink-args=libcrypto.lib';
|
||||
|
@ -18,19 +18,21 @@ const childProcess = require('child_process');
|
||||
|
||||
module.exports = async function(hakEnv, moduleInfo) {
|
||||
// of course tcl doesn't have a --version
|
||||
await new Promise((resolve, reject) => {
|
||||
const proc = childProcess.spawn('tclsh', [], {
|
||||
stdio: ['pipe', 'ignore', 'ignore'],
|
||||
if (!hakEnv.isLinux()) {
|
||||
await new Promise((resolve, reject) => {
|
||||
const proc = childProcess.spawn('tclsh', [], {
|
||||
stdio: ['pipe', 'ignore', 'ignore'],
|
||||
});
|
||||
proc.on('exit', (code) => {
|
||||
if (code !== 0) {
|
||||
reject("Can't find tclsh - have you installed TCL?");
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
proc.stdin.end();
|
||||
});
|
||||
proc.on('exit', (code) => {
|
||||
if (code !== 0) {
|
||||
reject("Can't find tclsh - have you installed TCL?");
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
proc.stdin.end();
|
||||
});
|
||||
}
|
||||
|
||||
const tools = [];
|
||||
if (hakEnv.isWin()) {
|
||||
|
@ -23,7 +23,9 @@ const needle = require('needle');
|
||||
const tar = require('tar');
|
||||
|
||||
module.exports = async function(hakEnv, moduleInfo) {
|
||||
await getSqlCipher(hakEnv, moduleInfo);
|
||||
if (!hakEnv.isLinux()) {
|
||||
await getSqlCipher(hakEnv, moduleInfo);
|
||||
}
|
||||
|
||||
if (hakEnv.isWin()) {
|
||||
getOpenSsl(hakEnv, moduleInfo);
|
||||
|
@ -18,9 +18,11 @@
|
||||
"start": "electron .",
|
||||
"lint": "eslint src/ scripts/ hak/",
|
||||
"build": "yarn run setversion && electron-builder",
|
||||
"in-docker": "scripts/in-docker.sh",
|
||||
"docker:build": "yarn run in-docker yarn run build",
|
||||
"docker:install": "yarn run in-docker yarn install",
|
||||
"buildnative": "yarn run hak",
|
||||
"docker:setup": "docker build -t riot-desktop-dockerbuild dockerbuild",
|
||||
"docker:buildnative": "scripts/in-docker.sh yarn run hak",
|
||||
"docker:build": "scripts/in-docker.sh yarn run build",
|
||||
"docker:install": "scripts/in-docker.sh yarn install",
|
||||
"debrepo": "scripts/mkrepo.sh",
|
||||
"clean": "rimraf webapp.asar dist packages deploys",
|
||||
"hak": "node scripts/hak/index.js"
|
||||
|
@ -3,7 +3,7 @@ License: Apache-2.0
|
||||
Vendor: support@riot.im
|
||||
Architecture: amd64
|
||||
Maintainer: support@riot.im
|
||||
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libappindicator3-1, libsecret-1-0
|
||||
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libappindicator3-1, libsecret-1-0, libsqlcipher0
|
||||
Provides: riot-web
|
||||
Conflicts: riot-web
|
||||
Replaces: riot-web
|
||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
async function build(hakEnv, moduleInfo) {
|
||||
moduleInfo.scripts.build(hakEnv, moduleInfo);
|
||||
await moduleInfo.scripts.build(hakEnv, moduleInfo);
|
||||
}
|
||||
|
||||
module.exports = build;
|
||||
|
@ -89,45 +89,47 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
let cmds;
|
||||
if (process.argv.length < 3) {
|
||||
console.log("Usage: hak <command> [modules...]");
|
||||
process.exit(1);
|
||||
cmds = ['check', 'fetch', 'fetchDeps', 'build', 'copy', 'link'];
|
||||
} else {
|
||||
cmds = [process.argv[2]];
|
||||
}
|
||||
|
||||
const cmd = process.argv[2];
|
||||
if (GENERALCOMMANDS.includes(cmd)) {
|
||||
if (cmd === 'target') {
|
||||
console.log(hakEnv.getNodeTriple());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MODULECOMMANDS.includes(cmd)) {
|
||||
console.error("Unknown command: " + cmd);
|
||||
console.log("Commands I know about:");
|
||||
for (const cmd of MODULECOMMANDS) {
|
||||
console.log("\t" + cmd);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const cmdFunc = require('./' + cmd);
|
||||
|
||||
let modules = process.argv.slice(3);
|
||||
|
||||
if (modules.length === 0) modules = Object.keys(deps);
|
||||
|
||||
for (const mod of modules) {
|
||||
const depInfo = deps[mod];
|
||||
if (depInfo === undefined) {
|
||||
console.log(
|
||||
"Module " + mod + " not found - is it in hakDependencies " +
|
||||
"in your package.json?",
|
||||
);
|
||||
for (const cmd of cmds) {
|
||||
if (GENERALCOMMANDS.includes(cmd)) {
|
||||
if (cmd === 'target') {
|
||||
console.log(hakEnv.getNodeTriple());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MODULECOMMANDS.includes(cmd)) {
|
||||
console.error("Unknown command: " + cmd);
|
||||
console.log("Commands I know about:");
|
||||
for (const cmd of MODULECOMMANDS) {
|
||||
console.log("\t" + cmd);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("hak " + cmd + ": " + mod);
|
||||
await cmdFunc(hakEnv, depInfo);
|
||||
|
||||
const cmdFunc = require('./' + cmd);
|
||||
|
||||
for (const mod of modules) {
|
||||
const depInfo = deps[mod];
|
||||
if (depInfo === undefined) {
|
||||
console.log(
|
||||
"Module " + mod + " not found - is it in hakDependencies " +
|
||||
"in your package.json?",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("hak " + cmd + ": " + mod);
|
||||
await cmdFunc(hakEnv, depInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker inspect riot-desktop-dockerbuild 2> /dev/null > /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo "Docker image riot-desktop-builder not found. Have you run yarn run docker:setup?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Taken from https://www.electron.build/multi-platform-build#docker
|
||||
docker run --rm -ti \
|
||||
--env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
|
||||
--env ELECTRON_CACHE="/root/.cache/electron" \
|
||||
--env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
|
||||
-v ${PWD}:/project \
|
||||
-v ${PWD}/docker_node_modules:/project/node_modules \
|
||||
-v ${PWD}/docker/node_modules:/project/node_modules \
|
||||
-v ${PWD}/docker/.hak:/project/.hak \
|
||||
-v ~/.cache/electron:/root/.cache/electron \
|
||||
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
|
||||
electronuserland/builder "$@"
|
||||
riot-desktop-dockerbuild "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user