🔥 Do not provide a custom boostraper

This commit is contained in:
trickypr 2022-05-08 13:28:41 +10:00
parent 904cf370a4
commit 7d59b51260
7 changed files with 7 additions and 152 deletions

View file

@ -45,7 +45,6 @@
"execa": "^5.1.1", "execa": "^5.1.1",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"glob": "^7.1.7", "glob": "^7.1.7",
"linus": "^0.0.6",
"listr": "^0.14.3", "listr": "^0.14.3",
"modern-async": "^1.1.2", "modern-async": "^1.1.2",
"png-to-ico": "^2.1.4", "png-to-ico": "^2.1.4",

View file

@ -1,109 +1,20 @@
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
/// <reference path="./linus.d.ts"/>
import distro from 'linus' import { config } from '..'
import { bin_name } from '..'
import { ENGINE_DIR } from '../constants' import { ENGINE_DIR } from '../constants'
import { log } from '../log' import { log } from '../log'
import { dispatch } from '../utils' import { configDispatch } from '../utils'
import { pacmanInstall } from './bootstrap/arch'
import { aptInstall } from './bootstrap/debian'
export const bootstrap = async () => { export const bootstrap = async () => {
if (process.platform == 'win32') log.info(`Bootstrapping ${config.name}...`)
log.error(
`You do not need to bootstrap on Windows. As long as you ran |${bin_name} download-artifacts| everything should work fine.`
)
log.info(`Bootstrapping Dot Browser for Desktop...`)
const args = ['--application-choice', 'browser'] const args = ['--application-choice', 'browser']
if (process.platform === 'linux') { console.debug(`Passing through to |mach bootstrap|`)
linuxBootstrap() await configDispatch('./mach', {
} else { args: ['bootstrap', ...args],
console.info( cwd: ENGINE_DIR,
`Custom bootstrapping doesn't work on ${process.platform}. Consider contributing to improve support`
)
console.info(`Passing through to |mach bootstrap|`)
await dispatch(`./mach`, ['bootstrap', ...args], ENGINE_DIR)
}
}
function getDistro(): Promise<string> {
return new Promise((resolve, reject) => {
distro.name((err: Error, name: string) => {
if (name) resolve(name)
else {
reject(err || 'Failed to get linux distro')
}
})
}) })
} }
async function linuxBootstrap() {
const distro = await getDistro()
switch (distro) {
// Both arch and manjaro use the same package repo and the same package manager
case 'ManjaroLinux':
case 'ArchLinux':
console.log(
await pacmanInstall(
// Shared packages
'base-devel',
'nodejs',
'unzip',
'zip',
// Needed for desktop apps
'alsa-lib',
'dbus-glib',
'gtk3',
'libevent',
'libvpx',
'libxt',
'mime-types',
'nasm',
'startup-notification',
'gst-plugins-base-libs',
'libpulse',
'xorg-server-xvfb',
'gst-libav',
'gst-plugins-good',
'wasi-libc'
)
)
break
case 'Debian':
case 'Ubuntu':
case 'Pop':
console.log(
await aptInstall(
'python3-distutils',
'libssl-dev',
'build-essential',
'libpulse-dev',
'clang',
'nasm',
'libpango1.0-dev',
'libx11-dev',
'libx11-xcb-dev',
'libgtk-3-dev',
'm4',
'libgtk2.0-dev',
'libdbus-glib-1-dev',
'libxt-dev'
)
)
break
default:
log.error(`Unimplemented distro '${distro}'`)
}
}

View file

@ -1,9 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import execa from 'execa'
export async function pacmanInstall(...packages: string[]): Promise<string> {
return (await execa('sudo', ['pacman', '--noconfirm', '-S', ...packages]))
.stdout
}

View file

@ -1,8 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import execa from 'execa'
export async function aptInstall(...packages: string[]): Promise<string> {
return (await execa('sudo', ['apt', 'install', '-y', ...packages])).stdout
}

View file

@ -1,8 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
const brewDependencies = [
'gnu-tar', // MacOS tar doesn't support the --transform option
]
export async function bootstrapMacos() {}

View file

@ -1,6 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
declare module 'linus' {
export function name(callback: (error: Error, name: string) => void): void
}

View file

@ -2061,11 +2061,6 @@ get-stream@^6.0.0:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
getos@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/getos/-/getos-1.0.1.tgz#b28cbd12ec7aeb4462e5bb52217c4ec61696a9c5"
integrity sha1-soy9Eux660Ri5btSIXxOxhaWqcU=
gifwrap@^0.9.2: gifwrap@^0.9.2:
version "0.9.4" version "0.9.4"
resolved "https://registry.yarnpkg.com/gifwrap/-/gifwrap-0.9.4.tgz#f4eb6169ba027d61df64aafbdcb1f8ae58ccc0c5" resolved "https://registry.yarnpkg.com/gifwrap/-/gifwrap-0.9.4.tgz#f4eb6169ba027d61df64aafbdcb1f8ae58ccc0c5"
@ -2910,15 +2905,6 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
linus@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/linus/-/linus-0.0.6.tgz#ebc400367035784d851c332302a8857bf50b3f13"
integrity sha1-68QANnA1eE2FHDMjAqiFe/ULPxM=
dependencies:
getos "^1.0.1"
memorize "0.0.4"
whenever "0.0.2"
listr-silent-renderer@^1.1.1: listr-silent-renderer@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e"
@ -3036,11 +3022,6 @@ makeerror@1.0.12:
dependencies: dependencies:
tmpl "1.0.5" tmpl "1.0.5"
memorize@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/memorize/-/memorize-0.0.4.tgz#28e7a917888548addc5566f94eae8b400bb41a3e"
integrity sha1-KOepF4iFSK3cVWb5Tq6LQAu0Gj4=
merge-stream@^2.0.0: merge-stream@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
@ -4098,11 +4079,6 @@ whatwg-url@^8.0.0, whatwg-url@^8.5.0:
tr46 "^2.1.0" tr46 "^2.1.0"
webidl-conversions "^6.1.0" webidl-conversions "^6.1.0"
whenever@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/whenever/-/whenever-0.0.2.tgz#a23370410992761c0c82f179e2bd30df4bb9cced"
integrity sha1-ojNwQQmSdhwMgvF54r0w30u5zO0=
which@^2.0.1: which@^2.0.1:
version "2.0.2" version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"