diff --git a/Makefile b/Makefile index f08d757..a924160 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ all: build/icon.icns build/icon.ico win mac linux -win: resources/win/mmseqs.bat resources/win/mmseqs-web-backend.exe -mac: resources/mac/mmseqs resources/mac/arm64/mmseqs-web-backend resources/mac/x64/mmseqs-web-backend -linux: resources/linux/mmseqs-sse41 resources/linux/mmseqs-avx2 resources/linux/mmseqs-web-backend +win: resources/win/x64/mmseqs.bat resources/win/x64/mmseqs-web-backend.exe +mac: resources/mac/x64/mmseqs resources/mac/arm64/mmseqs resources/mac/arm64/mmseqs-web-backend resources/mac/x64/mmseqs-web-backend +linux: resources/linux/arm64/mmseqs resources/linux/arm64/mmseqs-web-backend resources/linux/x64/mmseqs resources/linux/x64/mmseqs-web-backend mmseqshash := 19064f27c8d86fcdcd3daad60f6db70f6360f30b @@ -22,31 +22,55 @@ resources/mac/arm64/mmseqs-web-backend: backend/*.go backend/go.* mkdir -p resources/mac/arm64 cd backend/ && GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ../resources/mac/arm64/mmseqs-web-backend -resources/linux/mmseqs-web-backend: backend/*.go backend/go.* - mkdir -p resources/linux - cd backend/ && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/linux/mmseqs-web-backend +resources/linux/x64/mmseqs-web-backend: backend/*.go backend/go.* + mkdir -p resources/linux/x64 + cd backend/ && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/linux/x64/mmseqs-web-backend -resources/win/mmseqs-web-backend.exe: backend/*.go backend/go.* - mkdir -p resources/win - cd backend/ && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/win/mmseqs-web-backend.exe +resources/linux/arm64/mmseqs-web-backend: backend/*.go backend/go.* + mkdir -p resources/linux/arm64 + cd backend/ && GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o ../resources/linux/arm64/mmseqs-web-backend + +resources/win/x64/mmseqs-web-backend.exe: backend/*.go backend/go.* + mkdir -p resources/win/x64 + cd backend/ && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/win/x64/mmseqs-web-backend.exe resources/mac/mmseqs: mkdir -p resources/mac wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-osx-universal.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/mac/mmseqs + chmod +x resources/mac/mmseqs + +resources/mac/x64/mmseqs: resources/mac/mmseqs + mkdir -p resources/mac/x64 + lipo resources/mac/mmseqs -remove arm64 -output resources/mac/x64/mmseqs || cp -f -- resources/mac/mmseqs resources/mac/x64/mmseqs + +resources/mac/arm64/mmseqs: resources/mac/mmseqs + mkdir -p resources/mac/arm64 + lipo resources/mac/mmseqs -thin arm64 -output resources/mac/arm64/mmseqs || cp -f -- resources/mac/mmseqs resources/mac/arm64/mmseqs + +resources/linux/x64/mmseqs-sse41: + mkdir -p resources/linux/x64 + wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-linux-sse41.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/linux/x64/mmseqs-sse41 + chmod +x resources/linux/x64/mmseqs-sse41 + +resources/linux/x64/mmseqs-avx2: + mkdir -p resources/linux/x64 + wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-linux-avx2.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/linux/x64/mmseqs-avx2 + chmod +x resources/linux/x64/mmseqs-avx2 -resources/linux/mmseqs-sse41: - mkdir -p resources/linux - wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-linux-sse41.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/linux/mmseqs-sse41 +resources/linux/x64/mmseqs: electron/mmseqs-wrapper.sh resources/linux/x64/mmseqs-avx2 resources/linux/x64/mmseqs-sse41 + cp electron/mmseqs-wrapper.sh resources/linux/x64/mmseqs + chmod +x resources/linux/x64/mmseqs -resources/linux/mmseqs-avx2: - mkdir -p resources/linux - wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-linux-avx2.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/linux/mmseqs-avx2 +resources/linux/arm64/mmseqs: + mkdir -p resources/linux/arm64 + wget -nv -q -O - https://mmseqs.com/archive/$(mmseqshash)/mmseqs-linux-arm64.tar.gz | tar -xOf - mmseqs/bin/mmseqs > resources/linux/arm64/mmseqs + chmod +x resources/linux/arm64/mmseqs -resources/win/mmseqs.bat: - mkdir -p resources/win - cd resources/win && wget -nv -O mmseqs-win64.zip https://mmseqs.com/archive/$(mmseqshash)/mmseqs-win64.zip \ +resources/win/x64/mmseqs.bat: + mkdir -p resources/win/x64 + cd resources/win/x64 && wget -nv -O mmseqs-win64.zip https://mmseqs.com/archive/$(mmseqshash)/mmseqs-win64.zip \ && unzip mmseqs-win64.zip && mv mmseqs/* . && rmdir mmseqs && rm mmseqs-win64.zip - chmod -R +x resources/win/mmseqs.bat resources/win/bin/* + chmod -R +x resources/win/x64/mmseqs.bat resources/win/x64/bin/* clean: @rm -f build/icon.icns build/icon.ico diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebf4063..2d1877f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,7 +27,7 @@ steps: secureFile: certificate.p12 - task: CmdLine@2 inputs: - script: ./node_modules/.bin/electron-builder --x64 -mwl + script: ./node_modules/.bin/electron-builder -mwl env: CSC_LINK: $(certificate.secureFilePath) CSC_KEY_PASSWORD: $(CSC_KEY_PASSWORD) diff --git a/electron/index.js b/electron/index.js index c686b1b..1c911dd 100644 --- a/electron/index.js +++ b/electron/index.js @@ -4,7 +4,7 @@ import { default as fp } from 'find-free-port'; import { default as os } from 'os'; import { createReadStream, createWriteStream } from 'fs'; import { randomBytes } from 'crypto'; -import { parse, join, dirname } from 'path'; +import { parse, join } from 'path'; import appRootDir from 'app-root-dir'; import defaultMenu from './menu'; import contextMenu from './context' @@ -34,7 +34,7 @@ const mapPlatform = (platform) => { } const binPath = (process.env.NODE_ENV === 'production') ? join(process.resourcesPath, 'bin') : - join(appRootDir.get(), 'resources', mapPlatform(platform)); + join(appRootDir.get(), 'resources', mapPlatform(platform), os.arch()); app.os = { arch: os.arch(), @@ -132,16 +132,24 @@ console.log(err); function createWindow() { mainWindow = new BrowserWindow({ + backgroundColor: "#FAFAFA", height: 615, useContentSize: true, width: 1000, + show: false, + // titleBarStyle: "hidden", webPreferences: { enableRemoteModule: true, nodeIntegration: true, + contextIsolation: false } }); mainWindow.loadURL(winURL); + + mainWindow.once('ready-to-show', () => { + mainWindow.show() + }); mainWindow.webContents.on('new-window', (e, url) => { if (url != mainWindow.webContents.getURL()) { diff --git a/electron/mmseqs-wrapper.sh b/electron/mmseqs-wrapper.sh new file mode 100755 index 0000000..fe6ef14 --- /dev/null +++ b/electron/mmseqs-wrapper.sh @@ -0,0 +1,11 @@ +#/bin/sh +DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +FLAGS="$(grep -m 1 '^flags' /proc/cpuinfo)" +case "${FLAGS}" in + *avx2*) + exec "${DIR}/mmseqs-avx2" "$@" + ;; + *) + exec "${DIR}/mmseqs-sse41" "$@" + ;; +esac diff --git a/package.json b/package.json index 12791db..c029b79 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "main": "dist/main.js", "scripts": { "electron:deps": "make all", - "electron:build": "npm run electron:deps && cross-env ELECTRON=1 node ./electron/build.js && electron-builder --x64 -mwl", - "electron:dir": "npm run electron:deps && cross-env ELECTRON=1 node ./electron/build.js && electron-builder --x64 --dir", + "electron:build": "npm run electron:deps && cross-env ELECTRON=1 node ./electron/build.js && electron-builder -mwl", + "electron:dir": "npm run electron:deps && cross-env ELECTRON=1 node ./electron/build.js && electron-builder --dir", "electron:dev": "cross-env ELECTRON=1 node ./electron/dev-runner.js", "electron:pack": "npm run electron:main && cross-env ELECTRON=1 npm run frontend", "electron:main": "webpack -p --progress --hide-modules --colors --config ./webpack.electron.config.js", @@ -36,10 +36,6 @@ "dist/**/*" ], "extraFiles": [ - { - "from": "resources/${os}", - "to": "resources/bin" - }, { "from": "resources/${os}/${arch}", "to": "resources/bin" @@ -60,8 +56,30 @@ } ] }, + "win": { + "target": [ + { + "target": "nsis", + "arch": [ "x64" ] + } + ] + }, "linux": { - "category": "Science" + "category": "Science", + "target": [ + { + "target": "AppImage", + "arch": [ "x64", "arm64" ] + } + ] + }, + "mac": { + "target": [ + { + "target": "dmg", + "arch": [ "universal" ] + } + ] } }, "devDependencies": {