LoginSignup
2
1

More than 5 years have passed since last update.

Ubunto 17.04にyes-precure5-commandをインストールする

Last updated at Posted at 2017-12-03

@greymd さんの
【たのしいな】様々なコマンド達を何も考えずにつないで遊ぶ
https://qiita.com/greymd/items/a4ecf8e70f11eb1e5f72
を見てやってみたい!と思ったけど、haskellとかcabalとかのインストールの仕方がわからずハマったので最終的にどうすれば簡単にできたかをめも(ubuntu haskell install, ubuntu cabal installあたりで調べるとソースからコンパイルするような記事が結構あったけど、apt-getでサクッといけた)

環境

Vagrant + Ubuntu17.04

自分の書いた記事で、Windows10 + Vagrant + Ubunto17.04 を立ててみた、を参考に同じ環境が作れます
https://qiita.com/honeycom/items/bb2e2d8710f9e3c799d9

手順

まずパッケージ全体を最新にする

apt-get update

haskell-platformをインストールする
依存関係で以下のような多数のパッケージがインストールされる

vagrant@vagrant:~$ sudo apt-get install haskell-platform
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  alex cabal-install freeglut3 freeglut3-dev ghc happy hscolour libbsd-dev
  libdrm-amdgpu1 libdrm-dev libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libffi-dev libghc-async-dev libghc-attoparsec-dev
  libghc-case-insensitive-dev libghc-fgl-dev libghc-fixed-dev
  libghc-gluraw-dev libghc-glut-dev libghc-half-dev libghc-hashable-dev
  libghc-haskell-src-dev libghc-html-dev libghc-http-dev libghc-hunit-dev
  libghc-mtl-dev libghc-network-dev libghc-network-uri-dev
  libghc-objectname-dev libghc-opengl-dev libghc-openglraw-dev
  libghc-parallel-dev libghc-parsec3-dev libghc-primitive-dev
  libghc-quickcheck2-dev libghc-random-dev libghc-regex-base-dev
  libghc-regex-compat-dev libghc-regex-posix-dev libghc-scientific-dev
  libghc-split-dev libghc-statevar-dev libghc-stm-dev libghc-syb-dev
  libghc-text-dev libghc-tf-random-dev libghc-unordered-containers-dev
  libghc-vector-dev libghc-zlib-dev libgl1-mesa-dev libgl1-mesa-dri
  libgl1-mesa-glx libglapi-mesa libglu1-mesa libglu1-mesa-dev libgmp-dev
  libgmpxx4ldbl libice-dev libice6 libllvm4.0 libncurses5-dev libpciaccess0
  libpthread-stubs0-dev libsensors4 libsm-dev libsm6 libtxc-dxtn-s2tc libx11-6
  libx11-data libx11-dev libx11-doc libx11-xcb-dev libx11-xcb1 libxau-dev
  libxau6 libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev
  libxcb-glx0 libxcb-glx0-dev libxcb-present-dev libxcb-present0 libxcb-randr0
  libxcb-randr0-dev libxcb-render0 libxcb-render0-dev libxcb-shape0
  libxcb-shape0-dev libxcb-sync-dev libxcb-sync1 libxcb-xfixes0
  libxcb-xfixes0-dev libxcb1 libxcb1-dev libxdamage-dev libxdamage1
  libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxfixes-dev libxfixes3
  libxi-dev libxi6 libxmu-dev libxmu-headers libxmu6 libxshmfence-dev
  libxshmfence1 libxt-dev libxt6 libxxf86vm-dev libxxf86vm1 mesa-common-dev
  x11-common x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev
  x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev
  x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
  ghc-prof ghc-doc haskell-doc llvm-3.7 haskell-platform-doc
  haskell-platform-prof libghc-async-doc libghc-async-prof
  libghc-attoparsec-doc libghc-attoparsec-prof libghc-case-insensitive-doc
  libghc-case-insensitive-prof libghc-fgl-doc libghc-fgl-prof libghc-fixed-doc
  libghc-fixed-prof libghc-gluraw-doc libghc-gluraw-prof libghc-glut-doc
  libghc-glut-prof libghc-half-doc libghc-half-prof libghc-hashable-doc
  libghc-hashable-prof libghc-haskell-src-doc libghc-haskell-src-prof
  libghc-html-doc libghc-html-prof libghc-http-doc libghc-http-prof
  libghc-hunit-doc libghc-hunit-prof libghc-mtl-doc libghc-mtl-prof
  libghc-network-doc libghc-network-prof libghc-network-uri-doc
  libghc-network-uri-prof libghc-objectname-doc libghc-objectname-prof
  libghc-opengl-doc libghc-opengl-prof libghc-openglraw-doc
  libghc-openglraw-prof libghc-parallel-doc libghc-parallel-prof
  libghc-parsec3-doc libghc-parsec3-prof libghc-primitive-doc
  libghc-primitive-prof libghc-quickcheck2-doc libghc-quickcheck2-prof
  libghc-random-doc libghc-random-prof libghc-regex-base-doc
  libghc-regex-base-prof libghc-regex-compat-doc libghc-regex-compat-prof
  libghc-regex-posix-doc libghc-regex-posix-prof libghc-scientific-doc
  libghc-scientific-prof libghc-split-doc libghc-split-prof
  libghc-statevar-doc libghc-statevar-prof libghc-stm-doc libghc-stm-prof
  libghc-syb-doc libghc-syb-prof libghc-text-doc libghc-text-prof
  libghc-tf-random-doc libghc-tf-random-prof libghc-unordered-containers-doc
  libghc-unordered-containers-prof libghc-vector-doc libghc-vector-prof
  libghc-zlib-doc libghc-zlib-prof gmp-doc libgmp10-doc libmpfr-dev libice-doc
  ncurses-doc lm-sensors libsm-doc libxcb-doc libxext-doc libxt-doc
The following NEW packages will be installed:
  alex cabal-install freeglut3 freeglut3-dev ghc happy haskell-platform
  hscolour libbsd-dev libdrm-amdgpu1 libdrm-dev libdrm-intel1 libdrm-nouveau2
  libdrm-radeon1 libffi-dev libghc-async-dev libghc-attoparsec-dev
  libghc-case-insensitive-dev libghc-fgl-dev libghc-fixed-dev
  libghc-gluraw-dev libghc-glut-dev libghc-half-dev libghc-hashable-dev
  libghc-haskell-src-dev libghc-html-dev libghc-http-dev libghc-hunit-dev
  libghc-mtl-dev libghc-network-dev libghc-network-uri-dev
  libghc-objectname-dev libghc-opengl-dev libghc-openglraw-dev
  libghc-parallel-dev libghc-parsec3-dev libghc-primitive-dev
  libghc-quickcheck2-dev libghc-random-dev libghc-regex-base-dev
  libghc-regex-compat-dev libghc-regex-posix-dev libghc-scientific-dev
  libghc-split-dev libghc-statevar-dev libghc-stm-dev libghc-syb-dev
  libghc-text-dev libghc-tf-random-dev libghc-unordered-containers-dev
  libghc-vector-dev libghc-zlib-dev libgl1-mesa-dev libgl1-mesa-dri
  libgl1-mesa-glx libglapi-mesa libglu1-mesa libglu1-mesa-dev libgmp-dev
  libgmpxx4ldbl libice-dev libice6 libllvm4.0 libncurses5-dev libpciaccess0
  libpthread-stubs0-dev libsensors4 libsm-dev libsm6 libtxc-dxtn-s2tc libx11-6
  libx11-data libx11-dev libx11-doc libx11-xcb-dev libx11-xcb1 libxau-dev
  libxau6 libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev
  libxcb-glx0 libxcb-glx0-dev libxcb-present-dev libxcb-present0 libxcb-randr0
  libxcb-randr0-dev libxcb-render0 libxcb-render0-dev libxcb-shape0
  libxcb-shape0-dev libxcb-sync-dev libxcb-sync1 libxcb-xfixes0
  libxcb-xfixes0-dev libxcb1 libxcb1-dev libxdamage-dev libxdamage1
  libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxfixes-dev libxfixes3
  libxi-dev libxi6 libxmu-dev libxmu-headers libxmu6 libxshmfence-dev
  libxshmfence1 libxt-dev libxt6 libxxf86vm-dev libxxf86vm1 mesa-common-dev
  x11-common x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev
  x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev
  x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 130 newly installed, 0 to remove and 50 not upgraded.
Need to get 69.6 MB/88.1 MB of archives.
After this operation, 987 MB of additional disk space will be used.

yes-precure5-commandをインストールしてみる
そんなパッケージない。cabal updateしてみなさいとメッセージが表示される

vagrant@vagrant:~$ cabal install yes-precure5-command
Config file path source is default config file.
Config file /home/vagrant/.cabal/config not found.
Writing default configuration to /home/vagrant/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
cabal: There is no package named 'yes-precure5-command'.
You may need to run 'cabal update' to get the latest list of available
packages.
vagrant@vagrant:~$

cabal updateする

vagrant@vagrant:~$ cabal update
Downloading the latest package list from hackage.haskell.org
vagrant@vagrant:~$

もう一回yes-precure5-commandをインストールしてみる

vagrant@vagrant:~$ cabal install yes-precure5-command
Resolving dependencies...
Downloading yes-precure5-command-5.5.3...
cabal: Entering directory '/tmp/cabal-tmp-6055/yes-precure5-command-5.5.3'
Configuring yes-precure5-command-5.5.3...
Building yes-precure5-command-5.5.3...
Preprocessing library yes-precure5-command-5.5.3...
[1 of 9] Compiling ACME.Yes.PreCure5.Parser.Common ( ACME/Yes/PreCure5/Parser/Common.hs, dist/build/ACME/Yes/PreCure5/Parser/Common.o )
[2 of 9] Compiling ACME.Yes.PreCure5.Parser ( ACME/Yes/PreCure5/Parser.hs, dist/build/ACME/Yes/PreCure5/Parser.o )
[3 of 9] Compiling ACME.Yes.PreCure5.GoGo.Parser ( ACME/Yes/PreCure5/GoGo/Parser.hs, dist/build/ACME/Yes/PreCure5/GoGo/Parser.o )
[4 of 9] Compiling ACME.Yes.PreCure5.Class ( ACME/Yes/PreCure5/Class.hs, dist/build/ACME/Yes/PreCure5/Class.o )
[5 of 9] Compiling ACME.Yes.PreCure5.Profiles ( ACME/Yes/PreCure5/Profiles.hs, dist/build/ACME/Yes/PreCure5/Profiles.o )
[6 of 9] Compiling ACME.Yes.PreCure5.GoGo.Profiles ( ACME/Yes/PreCure5/GoGo/Profiles.hs, dist/build/ACME/Yes/PreCure5/GoGo/Profiles.o )
[7 of 9] Compiling ACME.Yes.PreCure5.GoGo ( ACME/Yes/PreCure5/GoGo.hs, dist/build/ACME/Yes/PreCure5/GoGo.o )
[8 of 9] Compiling ACME.Yes.PreCure5.Random ( ACME/Yes/PreCure5/Random.hs, dist/build/ACME/Yes/PreCure5/Random.o )
[9 of 9] Compiling ACME.Yes.PreCure5 ( ACME/Yes/PreCure5.hs, dist/build/ACME/Yes/PreCure5.o )
Preprocessing executable 'yes' for yes-precure5-command-5.5.3...
[ 1 of 10] Compiling ACME.Yes.PreCure5.Parser.Common ( ACME/Yes/PreCure5/Parser/Common.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/Parser/Common.o )
[ 2 of 10] Compiling ACME.Yes.PreCure5.Parser ( ACME/Yes/PreCure5/Parser.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/Parser.o )
[ 3 of 10] Compiling ACME.Yes.PreCure5.GoGo.Parser ( ACME/Yes/PreCure5/GoGo/Parser.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/GoGo/Parser.o )
[ 4 of 10] Compiling ACME.Yes.PreCure5.Class ( ACME/Yes/PreCure5/Class.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/Class.o )
[ 5 of 10] Compiling ACME.Yes.PreCure5.Profiles ( ACME/Yes/PreCure5/Profiles.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/Profiles.o )
[ 6 of 10] Compiling ACME.Yes.PreCure5.GoGo.Profiles ( ACME/Yes/PreCure5/GoGo/Profiles.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/GoGo/Profiles.o )
[ 7 of 10] Compiling ACME.Yes.PreCure5.GoGo ( ACME/Yes/PreCure5/GoGo.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/GoGo.o )
[ 8 of 10] Compiling ACME.Yes.PreCure5.Random ( ACME/Yes/PreCure5/Random.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5/Random.o )
[ 9 of 10] Compiling ACME.Yes.PreCure5 ( ACME/Yes/PreCure5.hs, dist/build/yes/yes-tmp/ACME/Yes/PreCure5.o )
[10 of 10] Compiling Main             ( main.hs, dist/build/yes/yes-tmp/Main.o )
Linking dist/build/yes/yes ...
Creating package registration file:
/tmp/pkgConf-yes-precure5-command-5.52145174067468703135.3
Installing library in
/home/vagrant/.cabal/lib/x86_64-linux-ghc-8.0.2/yes-precure5-command-5.5.3-BbW3vickSGXBPx7LLPrHcA
Installing executable(s) in /home/vagrant/.cabal/bin
Warning: The directory /home/vagrant/.cabal/bin is not in the system search
path.
Registering yes-precure5-command-5.5.3...
cabal: Leaving directory '/tmp/cabal-tmp-6055/yes-precure5-command-5.5.3'
Installed yes-precure5-command-5.5.3
vagrant@vagrant:~$

成功した
コマンドをPATH環境変数にとおす

vagrant@vagrant:~$ echo 'export PATH=~/.cabal/bin/:$PATH' >> .bash_prifile
vagrant@vagrant:~$
vagrant@vagrant:~$ source .bash_prifile

いよいよ実行
->文字化け

vagrant@vagrant:~$ yes precure5 | head -9
怺㊤≡垂誥・
磁Dj

    ㊤・褝

爲褓ノ
闍署゚マオ蒡
遅褫怺㊤・

怺㊤≡垂誥・
磁ト・

    ㊤・褝

爲褓ノ
闍署゚マオ蒡
猪砠ⅵタ銓碚、

ロケールを日本語にする
変更前はen_US

vagrant@vagrant:~$ locale
LANG=en_US
LANGUAGE=en_US:
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=
vagrant@vagrant:~$

language-pack-jaをインストールする

vagrant@vagrant:~$ sudo apt-get install -y language-pack-ja

update-localeコマンドを実行する

vagrant@vagrant:~$ sudo update-locale LANG=ja_JP.UTF-8

Tera termのウィンドウを複製して環境変数とかを読み込みなおさせる
localeが日本語になった

vagrant@vagrant:~$ locale
LANG=ja_JP.UTF-8
LANGUAGE=
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=
vagrant@vagrant:~$

再実行

vagrant@vagrant:~$ yes precure5 | head -9
プリキュア!メタモルフォーゼ!
大いなる希望の力、キュアドリーム!
情熱の赤い炎、キュアルージュ!
はじけるレモンの香り、キュアレモネード!
安らぎの緑の大地、キュアミント!
知性の青き泉、キュアアクア!
希望の力と未来の光!
華麗に羽ばたく5つの心!
Yes!プリキュア5!
vagrant@vagrant:~$

動きました!

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1