From 04ddd3aa73efab669eb5972895872a72238b6012 Mon Sep 17 00:00:00 2001 From: DhabyX Date: Sun, 26 Feb 2017 09:40:08 +0700 Subject: development/atom: Updated for version 1.14.3. Signed-off-by: Willy Sudiarto Raharjo --- development/atom/README | 12 ++- development/atom/atom.SlackBuild | 55 +++++++--- development/atom/atom.info | 6 +- development/atom/fix-atom.sh.patch | 115 +++++++++++++++++++++ .../atom/fix-ime-events-handler-electron-1.4.patch | 47 +++++++++ development/atom/use-system-electron.patch | 101 ++++++++++++++++++ 6 files changed, 315 insertions(+), 21 deletions(-) create mode 100644 development/atom/fix-atom.sh.patch create mode 100644 development/atom/fix-ime-events-handler-electron-1.4.patch create mode 100644 development/atom/use-system-electron.patch (limited to 'development/atom') diff --git a/development/atom/README b/development/atom/README index 93174ec239..801daa2b59 100644 --- a/development/atom/README +++ b/development/atom/README @@ -13,11 +13,21 @@ If you use apmd package you need rename apm tool. Optional building features: * Disable compiling metrics module for Google Analytics - for poeple who love your privacy + for people who love your privacy https://github.com/atom/metrics DISABLE_METRICS=yes|no (default: no) * Delete temporary data cached after building package DELETE_CACHE=yes|no (default: no) +* Use atom with some version of electron previously + installed in the system. This feature don't make + a distributable binary, and you can use like as node + script application. This requires electron + available in SBo + ELECTRON=yes|no (default=no) + +If you need to use any option do something like: + +ELECTRON=yes ./atom.SlackBuild NOTE: Atom may failed to build at first attempt. diff --git a/development/atom/atom.SlackBuild b/development/atom/atom.SlackBuild index a5641f7721..1f450cf56f 100644 --- a/development/atom/atom.SlackBuild +++ b/development/atom/atom.SlackBuild @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=atom -VERSION=${VERSION:-1.14.1} +VERSION=${VERSION:-1.14.3} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -31,6 +31,8 @@ TAG=${TAG:-_SBo} DISABLE_METRICS=${DISABLE_METRICS:-no} #Clean cache data after building DELETE_CACHE=${DELETE_CACHE:-no} +#Use pre-installed electron from SBo +ELECTRON=${ELECTRON:-no} if [ -z "$ARCH" ]; then case "$( uname -m )" in @@ -45,21 +47,17 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i586" ]; then - SLKCFLAGS="-O2 -march=i586 -mtune=i686" - LIBDIRSUFFIX="" - NPMARCH="ia32" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686 -mtune=i686" +if [[ "$ARCH" = "i"?"86" ]]; then LIBDIRSUFFIX="" NPMARCH="ia32" + ARCH_OUTPUT="i386" # for detect output directory elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" NPMARCH="x86_64" + ARCH_OUTPUT="amd64" # for detect output directory else - SLKCFLAGS="-O2" - LIBDIRSUFFIX="" + echo "Your platform $ARCH is not supported." + exit 1 fi set -e @@ -77,6 +75,21 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +if [ "$ELECTRON" != "no" ]; then + # test if electron is installed + ELECTRON_VERSION=$(electron --version | tr -d 'v') +fi + +if [ "${ELECTRON_VERSION}" != "" ]; then + # change electron version in package.json + sed -i -E -e 's/"electronVersion": "[0-9.]+"/"electronVersion": "'${ELECTRON_VERSION}'"/g' package.json + # patch for use electron pre-installed + patch -p1 < $CWD/use-system-electron.patch + patch -p1 < $CWD/fix-atom.sh.patch + # patch for IME events from ARCH AUR PKGBuild + patch -p1 < $CWD/fix-ime-events-handler-electron-1.4.patch +fi + if [ "$DISABLE_METRICS" = "yes" ]; then sed -i '/"metrics":/d' package.json fi @@ -93,16 +106,24 @@ PYTHON=python2 \ # Manual installation since --install-dir option is deleted # Installation based on spec file from official RPM package from atom install -d $PKG/usr/{bin,doc,share} -install -d $PKG/usr/share/atom/ -# detect output directory -ARCH_OUTPUT="i386" -if [ "$ARCH" = "x86_64" ]; then - ARCH_OUTPUT="amd64" +if [ "${ELECTRON_VERSION}" != "" ]; then + cp -r out/app $PKG/usr/share/atom + # apm - manually installation to upstream recommended place + ATOM_RESOURCES=/usr/share/atom/resources/app + install -d $PKG/$ATOM_RESOURCES + cp -r apm $PKG/$ATOM_RESOURCES + # fix paths for apm + sed -i -e 's#'$TMP/$PRGNAM-$VERSION'#'$ATOM_RESOURCES'#g' \ + $PKG/$ATOM_RESOURCES/apm/node_modules/atom-package-manager/package.json + sed -i -e 's#resources/app.asar##g' \ + $PKG/$ATOM_RESOURCES/apm/node_modules/atom-package-manager/lib/apm.js +else + # packaged installation + cp -r out/$PRGNAM-$VERSION-$ARCH_OUTPUT $PKG/usr/share/atom fi install -Dm755 atom.sh $PKG/usr/bin/atom -cp -r out/$PRGNAM-$VERSION-$ARCH_OUTPUT/* $PKG/usr/share/atom/ ( cd $PKG/usr/bin ln -sf ../share/atom/resources/app/apm/node_modules/.bin/apm apm @@ -111,7 +132,7 @@ cp -r out/$PRGNAM-$VERSION-$ARCH_OUTPUT/* $PKG/usr/share/atom/ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# use only if you use apmd package from slackware pastures +# use only if you use apmd package from Slackware pastures # mv $PKG/usr/bin/apm $PKG/usr/bin/atom-apm # move and configure icons and .desktop file diff --git a/development/atom/atom.info b/development/atom/atom.info index 618977a06c..c5f523d621 100644 --- a/development/atom/atom.info +++ b/development/atom/atom.info @@ -1,8 +1,8 @@ PRGNAM="atom" -VERSION="1.14.1" +VERSION="1.14.3" HOMEPAGE="https://atom.io/" -DOWNLOAD="https://codeload.github.com/atom/atom/tar.gz/v1.14.1" -MD5SUM="cc3948e576cc267a78d8cbe4a35a0e5f" +DOWNLOAD="https://codeload.github.com/atom/atom/tar.gz/v1.14.3" +MD5SUM="5a7370a2261f3f654c128a6c628c7d13" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="nodejs" diff --git a/development/atom/fix-atom.sh.patch b/development/atom/fix-atom.sh.patch new file mode 100644 index 0000000000..c65ae86d90 --- /dev/null +++ b/development/atom/fix-atom.sh.patch @@ -0,0 +1,115 @@ +diff -Naur a/atom.sh c/atom.sh +--- a/atom.sh 2017-02-17 10:53:06.000000000 -0600 ++++ c/atom.sh 2017-02-24 23:45:17.745685040 -0600 +@@ -1,14 +1,5 @@ + #!/bin/bash + +-if [ "$(uname)" == 'Darwin' ]; then +- OS='Mac' +-elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then +- OS='Linux' +-else +- echo "Your platform ($(uname -a)) is not supported." +- exit 1 +-fi +- + if [ "$(basename $0)" == 'atom-beta' ]; then + BETA_VERSION=true + else +@@ -54,79 +45,29 @@ + export ELECTRON_ENABLE_LOGGING=1 + fi + +-if [ $OS == 'Mac' ]; then +- if [ -L "$0" ]; then +- SCRIPT="$(readlink "$0")" +- else +- SCRIPT="$0" +- fi +- ATOM_APP="$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")")" +- if [ "$ATOM_APP" == . ]; then +- unset ATOM_APP +- else +- ATOM_PATH="$(dirname "$ATOM_APP")" +- ATOM_APP_NAME="$(basename "$ATOM_APP")" +- fi +- +- if [ -n "$BETA_VERSION" ]; then +- ATOM_EXECUTABLE_NAME="Atom Beta" +- else +- ATOM_EXECUTABLE_NAME="Atom" +- fi +- +- if [ -z "${ATOM_PATH}" ]; then +- # If ATOM_PATH isn't set, check /Applications and then ~/Applications for Atom.app +- if [ -x "/Applications/$ATOM_APP_NAME" ]; then +- ATOM_PATH="/Applications" +- elif [ -x "$HOME/Applications/$ATOM_APP_NAME" ]; then +- ATOM_PATH="$HOME/Applications" +- else +- # We haven't found an Atom.app, use spotlight to search for Atom +- ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs -0 dirname)" +- +- # Exit if Atom can't be found +- if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then +- echo "Cannot locate ${ATOM_APP_NAME}, it is usually located in /Applications. Set the ATOM_PATH environment variable to the directory containing ${ATOM_APP_NAME}." +- exit 1 +- fi +- fi +- fi + +- if [ $EXPECT_OUTPUT ]; then +- "$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/$ATOM_EXECUTABLE_NAME" --executed-from="$(pwd)" --pid=$$ "$@" +- exit $? +- else +- open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@" +- fi +-elif [ $OS == 'Linux' ]; then +- SCRIPT=$(readlink -f "$0") +- USR_DIRECTORY=$(readlink -f $(dirname $SCRIPT)/..) +- +- if [ -n "$BETA_VERSION" ]; then +- ATOM_PATH="$USR_DIRECTORY/share/atom-beta/atom" +- else +- ATOM_PATH="$USR_DIRECTORY/share/atom/atom" +- fi +- +- ATOM_HOME="${ATOM_HOME:-$HOME/.atom}" +- mkdir -p "$ATOM_HOME" ++if [ -n "$BETA_VERSION" ]; then ++ ATOM_PATH="electron --app=/usr/share/atom-beta/atom" ++else ++ ATOM_PATH="electron --app=/usr/share/atom" ++fi + +- : ${TMPDIR:=/tmp} ++ATOM_HOME="${ATOM_HOME:-$HOME/.atom}" ++mkdir -p "$ATOM_HOME" + +- [ -x "$ATOM_PATH" ] || ATOM_PATH="$TMPDIR/atom-build/Atom/atom" ++: ${TMPDIR:=/tmp} + +- if [ $EXPECT_OUTPUT ]; then +- "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" ++if [ $EXPECT_OUTPUT ]; then ++ $ATOM_PATH --executed-from="$(pwd)" --pid=$$ "$@" ++ exit $? ++else ++ ( ++ nohup $ATOM_PATH --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1 ++ if [ $? -ne 0 ]; then ++ cat "$ATOM_HOME/nohup.out" + exit $? +- else +- ( +- nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1 +- if [ $? -ne 0 ]; then +- cat "$ATOM_HOME/nohup.out" +- exit $? +- fi +- ) & + fi ++ ) & + fi + + # Exits this process when Atom is used as $EDITOR diff --git a/development/atom/fix-ime-events-handler-electron-1.4.patch b/development/atom/fix-ime-events-handler-electron-1.4.patch new file mode 100644 index 0000000000..db5681d4fd --- /dev/null +++ b/development/atom/fix-ime-events-handler-electron-1.4.patch @@ -0,0 +1,47 @@ +--- a/src/text-editor-component.coffee ++++ b/src/text-editor-component.coffee +@@ -110,6 +110,7 @@ class TextEditorComponent + @updateSync() + @checkForVisibilityChange() + @initialized = true ++ @checkpointForIME = null + + destroy: -> + @mounted = false +@@ -305,19 +306,20 @@ class TextEditorComponent + # User escape to cancel + # 4. compositionend fired + # OR User chooses a completion +- # 4. compositionend fired +- # 5. textInput fired; event.data == the completion string ++ # 4. textInput fired; event.data == the completion string ++ # 5. compositionend fired + +- checkpoint = null + @domNode.addEventListener 'compositionstart', => + if @openedAccentedCharacterMenu + @editor.selectLeft() + @openedAccentedCharacterMenu = false +- checkpoint = @editor.createCheckpoint() ++ @checkpointForIME = @editor.createCheckpoint() + @domNode.addEventListener 'compositionupdate', (event) => + @editor.insertText(event.data, select: true) + @domNode.addEventListener 'compositionend', (event) => +- @editor.revertToCheckpoint(checkpoint) ++ if @checkpointForIME ++ @editor.revertToCheckpoint(@checkpointForIME) ++ @checkpointForIME = null + event.target.value = '' + + # Listen for selection changes and store the currently selected text +@@ -354,6 +356,10 @@ class TextEditorComponent + onTextInput: (event) => + event.stopPropagation() + ++ if @checkpointForIME ++ @editor.revertToCheckpoint(@checkpointForIME) ++ @checkpointForIME = null ++ + # WARNING: If we call preventDefault on the input of a space character, + # then the browser interprets the spacebar keypress as a page-down command, + # causing spaces to scroll elements containing editors. This is impossible diff --git a/development/atom/use-system-electron.patch b/development/atom/use-system-electron.patch new file mode 100644 index 0000000000..cc97e04a65 --- /dev/null +++ b/development/atom/use-system-electron.patch @@ -0,0 +1,101 @@ +diff -Naur a/script/build b/script/build +--- a/script/build 2017-02-17 10:53:06.000000000 -0600 ++++ b/script/build 2017-02-22 23:35:29.241396450 -0600 +@@ -23,7 +23,6 @@ + .wrap(yargs.terminalWidth()) + .argv + +-const checkChromedriverVersion = require('./lib/check-chromedriver-version') + const cleanOutputDirectory = require('./lib/clean-output-directory') + const codeSignOnMac = require('./lib/code-sign-on-mac') + const compressArtifacts = require('./lib/compress-artifacts') +@@ -48,7 +47,6 @@ + process.exit(1) + }) + +-checkChromedriverVersion() + cleanOutputDirectory() + copyAssets() + transpileBabelPaths() +@@ -60,46 +58,3 @@ + generateMetadata() + generateAPIDocs() + dumpSymbols() +- .then(packageApplication) +- .then(packagedAppPath => { +- if (process.platform === 'darwin') { +- if (argv.codeSign) { +- codeSignOnMac(packagedAppPath) +- } else { +- console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing'.gray) +- } +- } else if (process.platform === 'win32') { +- if (argv.createWindowsInstaller) { +- return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) +- } +- else { +- console.log('Skipping creating installer. Specify the --create-windows-installer option to create a Squirrel-based Windows installer. Code-signing was skipped too.'.gray) +- } +- } else if (process.platform === 'linux') { +- if (argv.createDebianPackage) { +- createDebianPackage(packagedAppPath) +- } else { +- console.log('Skipping creating debian package. Specify the --create-debian-package option to create it.'.gray) +- } +- +- if (argv.createRpmPackage) { +- createRpmPackage(packagedAppPath) +- } else { +- console.log('Skipping creating rpm package. Specify the --create-rpm-package option to create it.'.gray) +- } +- } +- +- return Promise.resolve(packagedAppPath) +- }).then(packagedAppPath => { +- if (argv.compressArtifacts) { +- compressArtifacts(packagedAppPath) +- } else { +- console.log('Skipping artifacts compression. Specify the --compress-artifacts option to compress Atom binaries (and symbols on macOS)'.gray) +- } +- +- if (argv.install) { +- installApplication(packagedAppPath) +- } else { +- console.log('Skipping installation. Specify the --install option to install Atom'.gray) +- } +- }) +diff -Naur a/script/package.json b/script/package.json +--- a/script/package.json 2017-02-17 10:53:06.000000000 -0600 ++++ b/script/package.json 2017-02-22 23:36:47.888097996 -0600 +@@ -8,7 +8,6 @@ + "colors": "1.1.2", + "csslint": "1.0.2", + "donna": "1.0.13", +- "electron-chromedriver": "~1.3", + "electron-packager": "7.3.0", + "electron-winstaller": "2.5.1", + "fs-extra": "0.30.0", +diff -Naur a/src/main-process/atom-application.coffee b/src/main-process/atom-application.coffee +--- a/src/main-process/atom-application.coffee 2017-02-17 10:53:06.000000000 -0600 ++++ b/src/main-process/atom-application.coffee 2017-02-22 23:33:19.542590377 -0600 +@@ -797,7 +797,7 @@ + @restart() + + restart: -> +- args = [] ++ args = ["--app=/usr/share/atom"] + args.push("--safe") if @safeMode + args.push("--log-file=#{@logFile}") if @logFile? + args.push("--socket-path=#{@socketPath}") if @socketPath? +diff -Naur a/src/package-manager.coffee b/src/package-manager.coffee +--- a/src/package-manager.coffee 2017-02-17 10:53:06.000000000 -0600 ++++ b/src/package-manager.coffee 2017-02-25 02:23:32.459106058 -0600 +@@ -145,7 +145,7 @@ + apmRoot = path.join(process.resourcesPath, 'app', 'apm') + @apmPath = path.join(apmRoot, 'bin', commandName) + unless fs.isFileSync(@apmPath) +- @apmPath = path.join(apmRoot, 'node_modules', 'atom-package-manager', 'bin', commandName) ++ @apmPath = path.join('/usr/share/atom/resources/app/apm', 'node_modules', 'atom-package-manager', 'bin', commandName) + @apmPath + + # Public: Get the paths being used to look for packages. -- cgit v1.2.3