Skip to content

Instantly share code, notes, and snippets.

@ramcq
Created April 10, 2019 00:52
Show Gist options
  • Save ramcq/b51e70037aa009860d062d68a92cca53 to your computer and use it in GitHub Desktop.
Save ramcq/b51e70037aa009860d062d68a92cca53 to your computer and use it in GitHub Desktop.
Flatpak manifest for Scratch Desktop 3.0
{
"app-id": "edu.mit.scratch.ScratchDesktop",
"runtime": "org.freedesktop.Platform",
"runtime-version": "18.08",
"base": "org.electronjs.Electron2.BaseApp",
"base-version": "18.08",
"sdk": "org.freedesktop.Sdk",
"command": "scratch-desktop",
"separate-locales": false,
"finish-args": [
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=pulseaudio",
"--device=dri",
"--filesystem=home",
"--talk-name=org.freedesktop.Notifications"
],
"modules":[
{
"name": "electron-x86_64",
"only-arches": [ "x86_64" ],
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/bin/resources",
"cp *.so /app/bin",
"cp *.bin /app/bin",
"cp *.dat /app/bin",
"cp *.pak /app/bin",
"cp electron /app/bin/",
"cp -r resources/ /app/bin/"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/electron/electron/releases/download/v3.0.4/electron-v3.0.4-linux-x64.zip",
"sha512": "9e0febf884f652bc0b33088c87de4eba197e92283526e31ec3c51d649cf029da1b32d6fe5588acaa4420b8f74ea4f7e68ddf125f2c3b457eabbf766119212e76",
"strip-components": 0
}
]
},
{
"name": "electron-i386",
"only-arches": [ "i386" ],
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/bin/resources",
"cp *.so /app/bin",
"cp *.bin /app/bin",
"cp *.dat /app/bin",
"cp *.pak /app/bin",
"cp electron /app/bin/",
"cp -r resources/ /app/bin/"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/electron/electron/releases/download/v3.0.4/electron-v3.0.4-linux-ia32.zip",
"sha512": "0b9d297718c45215ddf5ec26e174435c90537e10fd84356f1e0c398b2d3acbc0aca003322d6748111f1b45923f9ebecd02e58843eca9ec1a3268ecd7702792e9",
"strip-components": 0
}
]
},
{
"name": "electron-arm",
"only-arches": [ "arm" ],
"buildsystem": "simple",
"build-commands": [
"mkdir -p ${FLATPAK_DEST}/bin/resources",
"cp *.so ${FLATPAK_DEST}/bin",
"cp *.bin ${FLATPAK_DEST}/bin",
"cp *.dat ${FLATPAK_DEST}/bin",
"cp *.pak ${FLATPAK_DEST}/bin",
"cp electron ${FLATPAK_DEST}/bin/",
"cp -r resources/ ${FLATPAK_DEST}/bin/"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/electron/electron/releases/download/v3.0.4/electron-v3.0.4-linux-armv7l.zip",
"sha512": "44843381e650c77a49da4262e5f274cd6db91deb669c5d2038e5c635d1842fa9abf766169eb732e14716cc48a227154588ce52ecb86d5502fbf29d35429a990f",
"strip-components": 0
}
]
},
{
"name": "electron-arm64",
"only-arches": [ "aarch64" ],
"buildsystem": "simple",
"build-commands": [
"mkdir -p ${FLATPAK_DEST}/bin/resources",
"cp *.so ${FLATPAK_DEST}/bin",
"cp *.bin ${FLATPAK_DEST}/bin",
"cp *.dat ${FLATPAK_DEST}/bin",
"cp *.pak ${FLATPAK_DEST}/bin",
"cp electron ${FLATPAK_DEST}/bin/",
"cp -r resources/ ${FLATPAK_DEST}/bin/"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/electron/electron/releases/download/v3.0.4/electron-v3.0.4-linux-arm64.zip",
"sha512": "7e0bde12d3b2e1ea8ee7545239092d786cf84b9e411a047c19e0188bc0a500eb6574ef9c60a4f26e2abce7fb3d823baa5947c09c4df6b052c153a07c7da7dcc2",
"strip-components": 0
}
]
},
{
"name": "p7zip",
"buildsystem": "simple",
"build-commands": [
"cp makefile.linux_any_cpu makefile.machine",
"make 7zr",
"install bin/7zr /app/bin"
],
"cleanup": [
"*"
],
"sources": [
{
"type": "archive",
"url": "https://vorboss.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2",
"sha512": "d2c4d53817f96bb4c7683f42045198d4cd509cfc9c3e2cb85c8d9dc4ab6dfa7496449edeac4e300ecf986a9cbbc90bd8f8feef8156895d94617c04e507add55f"
}
]
},
{
"name": "scratch-desktop",
"buildsystem": "simple",
"build-commands": [
"7zr x scratch-desktop.exe",
"cp resources/app.asar /app/bin/resources",
"cp -r resources/static /app/bin/resources",
"ln -s /app/bin/electron /app/bin/scratch-desktop"
],
"sources": [
{
"type": "file",
"url": "https://downloads.scratch.mit.edu/desktop/Scratch%20Desktop%20Setup%201.2.1.exe",
"sha512": "35aebf51772bd1d23076c192925630ad4ac02ff6a10ef2b9cf7cc5163d7410c153b834832dec7d466ee7f5e613251d0830338bb72cedf434510eb14cab6fd92f",
"dest-filename": "scratch-desktop.exe"
}
]
}
]
}
@ramcq
Copy link
Author

ramcq commented Apr 10, 2019

With this file saved as edu.mit.scratch.ScratchDesktop.json you can build and install a Flatpak like this:
flatpak-builder --user --install-deps-from=flathub --force-clean --ccache --repo=repo --install build edu.mit.scratch.ScratchDesktop.json

Then run with:
flatpak run edu.mit.scratch.ScratchDesktop

It doesn't have any desktop file / icon / metadata but that's not too hard to add. If I can figure out the license (ie, is the app.asar redistributable) we could submit to https://flathub.org.

@ramcq
Copy link
Author

ramcq commented Apr 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment