github製テキストエディタ atom (atom.io)を Linux (Fedora)で使う (おまけWindows)

githubテキストエディタatom(atom.io)さんがOSSになってリリースされてましたねー。
でも、 https://atom.io/ 上には、Macのビルドしか無いじゃん!!ってなるんですが、OSSになってから、各OSでのビルドがリリースされたり、ビルド方法が出てきました。

メイン開発環境は、Linux(Korora 20 Fedoraベースなので、ここで使いたいなーっと。(GUIKDEだったりします)

そのメモ。(尚この記事は、インフラ構築中の待ち時間の間に、気分転換に作業した内容となりますw)
こういうやり方の方がいいよ!!っていうのあったらご指摘、ご教授下さいませ!!

Linuxのビルド方法は、以下に記載されています。

https://github.com/atom/atom/blob/master/docs/build-instructions/linux.md

まぁ、これだけじゃ罠があるのですが。。。

1. 必要な依存モジュールをインストール

yum -y install node npm libgnome-keyring-devel

2. korora linuxは標準でgoogle chrome入れれるんですが yumのrepoが必要です。
(下記はkororaのrepoの内容)

vim /etc/yum.repos.d/google-chrome.repo

[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1

3. npmをアップグレードする必要があるので、その対応(Fedoraは1.3.6で、atomは1.4が必要)

cd ~
npm install npm

# ローカルnpmのbin PATHの設定
export PATH="$HOME/node_modules/.bin:$PATH"

# インストールされたnpmのバージョン確認
npm --version
# 1.4.10

4. パッケージのgypをアンインストールする ( issue #2029
これに気づくのに時間かかりました。

yum -y remove gyp

5. atomのコードをcloneしてbuildする。

git clone https://github.com/atom/atom
cd atom

./script/build
||< 

実行すると、以下のログがズラズラと表示されます。

>|sh|
npm WARN package.json github-url-from-git@1.1.1 No repository field.

Installing modules &#10003;
Installing atom-dark-syntax@0.15.0 &#10003;                                                                                           
Installing atom-dark-ui@0.26.0 &#10003;                                                                                               
Installing atom-light-syntax@0.17.0 &#10003;                                                                                          
Installing atom-light-ui@0.24.0 &#10003;                                                                                              
Installing base16-tomorrow-dark-theme@0.15.0 &#10003;                                                                                 
Installing solarized-dark-syntax@0.14.0 &#10003;                                                                                      
Installing solarized-light-syntax@0.7.0 &#10003;                                                                                      
Installing archive-view@0.30.0 &#10003;                                                                                               
Installing autocomplete@0.27.0 &#10003;                                                                                               
Installing autoflow@0.16.0 &#10003;                                                                                                   
Installing autosave@0.13.0 &#10003;                                                                                                   
Installing background-tips@0.13.0 &#10003;                                                                                            
Installing bookmarks@0.22.0 &#10003;                                                                                                  
Installing bracket-matcher@0.33.0 &#10003;                                                                                            
Installing command-palette@0.21.0 &#10003;                                                                                            
Installing deprecation-cop@0.5.0 &#10003;                                                                                             
Installing dev-live-reload@0.30.0 &#10003;                                                                                            
Installing exception-reporting@0.17.0 &#10003;                                                                                        
Installing feedback@0.33.0 &#10003;                                                                                                   
Installing find-and-replace@0.101.0 &#10003;                                                                                          
Installing fuzzy-finder@0.50.0 &#10003;                                                                                               
Installing git-diff@0.28.0 &#10003;                                                                                                   
Installing go-to-line@0.19.0 &#10003;                                                                                                 
Installing grammar-selector@0.26.0 &#10003;                                                                                           
Installing image-view@0.33.0 &#10003;                                                                                                 
Installing keybinding-resolver@0.17.0 &#10003;                                                                                        
Installing link@0.22.0 &#10003;                                                                                                       
Installing markdown-preview@0.69.0 &#10003;                                                                                           
Installing metrics@0.32.0 &#10003;                                                                                                    
Installing open-on-github@0.28.0 &#10003;                                                                                             
Installing package-generator@0.30.0 &#10003;                                                                                          
Installing release-notes@0.29.0 &#10003;                                                                                              
Installing settings-view@0.114.0 &#10003;                                                                                             
Installing snippets@0.43.0 &#10003;                                                                                                   
Installing spell-check@0.35.0 &#10003;                                                                                                
Installing status-bar@0.40.0 &#10003;                                                                                                 
Installing styleguide@0.29.0 &#10003;                                                                                                 
Installing symbols-view@0.51.0 &#10003;                                                                                               
Installing tabs@0.39.0 &#10003;                                                                                                       
Installing timecop@0.18.0 &#10003;                                                                                                    
Installing tree-view@0.92.0 &#10003;                                                                                                  
Installing update-package-dependencies@0.6.0 &#10003;                                                                                 
Installing welcome@0.13.0 &#10003;                                                                                                    
Installing whitespace@0.22.0 &#10003;                                                                                                 
Installing wrap-guide@0.18.0 &#10003;                                                                                                 
Installing language-c@0.15.0 &#10003;                                                                                                 
Installing language-coffee-script@0.22.0 &#10003;                                                                                     
Installing language-css@0.16.0 &#10003;                                                                                               
Installing language-gfm@0.34.0 &#10003;                                                                                               
Installing language-git@0.9.0 &#10003;                                                                                                
Installing language-go@0.11.0 &#10003;                                                                                                
Installing language-html@0.19.0 &#10003;                                                                                              
Installing language-hyperlink@0.9.0 &#10003;                                                                                          
Installing language-java@0.10.0 &#10003;                                                                                              
Installing language-javascript@0.25.0 &#10003;                                                                                        
Installing language-json@0.8.0 &#10003;                                                                                               
Installing language-less@0.9.0 &#10003;                                                                                               
Installing language-make@0.10.0 &#10003;                                                                                              
Installing language-objective-c@0.11.0 &#10003;                                                                                       
Installing language-perl@0.8.0 &#10003;
Installing language-php@0.14.0 &#10003;
Installing language-property-list@0.7.0 &#10003;
Installing language-python@0.15.0 &#10003;
Installing language-ruby@0.23.0 &#10003;
Installing language-ruby-on-rails@0.12.0 &#10003;
Installing language-sass@0.10.0 &#10003;
Installing language-shellscript@0.8.0 &#10003;
Installing language-source@0.7.0 &#10003;
Installing language-sql@0.8.0 &#10003;
Installing language-text@0.6.0 &#10003;
Installing language-todo@0.10.0 &#10003;
Installing language-toml@0.12.0 &#10003;
Installing language-xml@0.12.0 &#10003;
Installing language-yaml@0.6.0 &#10003;
Deduping modules &#10003;
Running "download-atom-shell" task


Running "build" task

Running "coffee:glob_to_multiple" (coffee) task

Running "prebuild-less:src" (prebuild-less) task

Running "cson:glob_to_multiple" (cson) task
>> 153 files compiled to JSON.

Running "peg:glob_to_multiple" (peg) task

Running "generate-license:save" (generate-license) task

Running "set-version" task
Done, without errors.

>> 153 files compiled to JSON.

Running "peg:glob_to_multiple" (peg) task

Running "generate-license:save" (generate-license) task

Running "set-version" task
Done, without errors.

6. makeされたatomバイナリに実行権限を付与

chmod +x /tmp/atom-build/Atom/atom

7. アンインストールしたnode-gypを再度インストールするしておく。(今後別のモジュール入れるのに忘れそうなので。。。)

yum -y install node-gyp

8. atomエディタの起動確認

LD_LIBRARY_PATH=/opt/google/chrome ./atom.sh

(∩´∀`)∩ワーイ 起動したってなりますw(日本語OKでした。かなりデカイ)

9. atomをアプリケーションフォルダに移動
/home/ユーザー名/Applications っていうフォルダに自分で導入したアプリを管理しているので、こっちに移動します。

mkdir -p ~/Applications/atom/share

mv /tmp/atom-build/Atom ~/Applications/atom/share/atom

cp resources/atom.png /home/dai_yamashita/Applications/atom/share/atom/resources/

cp atom.sh ~/Applications/atom/share

# 起動確認
LD_LIBRARY_PATH=/opt/google/chrome ~/Applications/atom/share/atom.sh

これで、おわりー!!

面倒なんで、起動シェルを書いてます。(起動確認コマンドと一緒)

#/bin/sh
LD_LIBRARY_PATH=/opt/google/chrome ~/Applications/atom/share/atom.sh

ちなみに、いろいろ自分で試行錯誤してたんですが、やり方はほとんど同じものでまとめて頂いているのがあったので、
そちらを参照頂く方が良いかと。。。w

https://gist.github.com/mojavelinux/225d01e621f467db1c75

こちらだと、/usr/share/applications/atom.desktop に書けば起動メニューから起動できるよ的なことを書いていますね。
(よくわかっていない)

vim /usr/share/applications/atom.desktop

[Desktop Entry]
Type=Application
Name=Atom
Comment=AEHOOOO
Icon=/opt/Atom/resources/app/resources/atom.png
Exec=/opt/Atom/atom.sh
Terminal=false
Categories=Development;

なんかわからないので、上記は実施していません。気になったので、ちょっとググってみたら、こんなのものあった。
http://pastebin.com/19e3y7c1

[Desktop Entry]
Name=Atom
Comment=Atom is a hackable text editor for the 21st century
Exec=atom %U
Icon=/home/cjgomes/.local/share/icons/atom.svg
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;TextEditor;

X-Ayatana-Desktop-Shortcuts=pncsaNew;eosbrNew;WindowNew;Root

[pncsaNew Shortcut Group]
Name=Projeto pncsawp
Exec=/usr/local/share/atom/atom --executed-from=/home/cjgomes/Documentos/github/pncsawp/ %U
TargetEnvironment=Unity

[eosbrNew Shortcut Group]
Name=Projeto eosbr
Exec=/usr/local/share/atom/atom --executed-from=/home/cjgomes/Documentos/github/eosbrwp/ %U
TargetEnvironment=Unity

[WindowNew Shortcut Group]
Name=Nova Janela
Exec=/usr/local/share/atom/atom %U
TargetEnvironment=Unity

[Root Shortcut Group]
Name=Nova Janela como _Administrator
Exec=gksu atom
TargetEnvironment=Unity

おまけ
Windows版のバイナリは公開されているので、以下からダウンロードできます。

http://blog.someguy123.com/atom-builds-for-windows/

それでは、皆さんよい、atom ライフを!!