41
Metasepi team meeting #8': Haskell apps on Android NDK Metasepi team meeting #8': Haskell apps on Android NDK Metasepi team meeting #8': Haskell apps on Android NDK Metasepi team meeting #8': Haskell apps on Android NDK Metasepi team meeting #8': Haskell apps on Android NDK Kiwamu Okabe Kiwamu Okabe Kiwamu Okabe Kiwamu Okabe Kiwamu Okabe

Metasepi team meeting #8': Haskell apps on Android NDK

Embed Size (px)

DESCRIPTION

Metasepi team meeting #8': Haskell apps on Android NDK

Citation preview

Page 1: Metasepi team meeting #8': Haskell apps on Android NDK

Metasepi team meeting #8': Haskell apps on Android NDK

Metasepi team meeting #8': Haskell apps on Android NDK

Metasepi team meeting #8': Haskell apps on Android NDK

Metasepi team meeting #8': Haskell apps on Android NDK

Metasepi team meeting #8':Haskell apps on Android NDK

Kiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu Okabe

Page 2: Metasepi team meeting #8': Haskell apps on Android NDK

Who am I?Who am I?Who am I?Who am I?Who am I?

☆ http://www.masterq.net/☆ http://www.masterq.net/☆ http://www.masterq.net/☆ http://www.masterq.net/☆ http://www.masterq.net/

☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q

☆ Organizer of Metasepi Project☆ Organizer of Metasepi Project☆ Organizer of Metasepi Project☆ Organizer of Metasepi Project☆ Organizer of Metasepi Project

☆ A developer of Ajhc Haskell compiler☆ A developer of Ajhc Haskell compiler☆ A developer of Ajhc Haskell compiler☆ A developer of Ajhc Haskell compiler☆ A developer of Ajhc Haskell compiler

☆ A Debian Maintainer☆ A Debian Maintainer☆ A Debian Maintainer☆ A Debian Maintainer☆ A Debian Maintainer

☆ 10 years' experience in developing OS using NetBSD.☆ 10 years' experience in developing OS using NetBSD.☆ 10 years' experience in developing OS using NetBSD.☆ 10 years' experience in developing OS using NetBSD.☆ 10 years' experience in developing OS using NetBSD.

Page 3: Metasepi team meeting #8': Haskell apps on Android NDK

AgendaAgendaAgendaAgendaAgenda

☆ [1] Demo☆ [1] Demo☆ [1] Demo☆ [1] Demo☆ [1] Demo

☆ [2] What is Ajhc?☆ [2] What is Ajhc?☆ [2] What is Ajhc?☆ [2] What is Ajhc?☆ [2] What is Ajhc?

☆ [3] What is Metasepi?☆ [3] What is Metasepi?☆ [3] What is Metasepi?☆ [3] What is Metasepi?☆ [3] What is Metasepi?

☆ [4] What is compiler to build OS☆ [4] What is compiler to build OS☆ [4] What is compiler to build OS☆ [4] What is compiler to build OS☆ [4] What is compiler to build OS

☆ [5] How to use Ajhc☆ [5] How to use Ajhc☆ [5] How to use Ajhc☆ [5] How to use Ajhc☆ [5] How to use Ajhc

☆ [6] Haskell on Android NDK☆ [6] Haskell on Android NDK☆ [6] Haskell on Android NDK☆ [6] Haskell on Android NDK☆ [6] Haskell on Android NDK

☆ [7] Status report of framework☆ [7] Status report of framework☆ [7] Status report of framework☆ [7] Status report of framework☆ [7] Status report of framework

Page 4: Metasepi team meeting #8': Haskell apps on Android NDK

[1] Demo[1] Demo[1] Demo[1] Demo[1] Demo

☆ A touchable cube demo.☆ A touchable cube demo.☆ A touchable cube demo.☆ A touchable cube demo.☆ A touchable cube demo.

☆ Haskell App runs on Android NDK.☆ Haskell App runs on Android NDK.☆ Haskell App runs on Android NDK.☆ Haskell App runs on Android NDK.☆ Haskell App runs on Android NDK.

☆ GC is breaked by ndk-gdb debugger.☆ GC is breaked by ndk-gdb debugger.☆ GC is breaked by ndk-gdb debugger.☆ GC is breaked by ndk-gdb debugger.☆ GC is breaked by ndk-gdb debugger.

☆ The App is available at Google Play.☆ The App is available at Google Play.☆ The App is available at Google Play.☆ The App is available at Google Play.☆ The App is available at Google Play.

http://bit.ly/cubeplayhttp://bit.ly/cubeplayhttp://bit.ly/cubeplayhttp://bit.ly/cubeplayhttp://bit.ly/cubeplay

☆ You can watch the movie following.☆ You can watch the movie following.☆ You can watch the movie following.☆ You can watch the movie following.☆ You can watch the movie following.

http://bit.ly/jhcdroidhttp://bit.ly/jhcdroidhttp://bit.ly/jhcdroidhttp://bit.ly/jhcdroidhttp://bit.ly/jhcdroid

Page 5: Metasepi team meeting #8': Haskell apps on Android NDK

Demo hardwareDemo hardwareDemo hardwareDemo hardwareDemo hardware

Nexus 7 (2012) / NVIDIA Tegra 3Nexus 7 (2012) / NVIDIA Tegra 3Nexus 7 (2012) / NVIDIA Tegra 3Nexus 7 (2012) / NVIDIA Tegra 3Nexus 7 (2012) / NVIDIA Tegra 3

Page 6: Metasepi team meeting #8': Haskell apps on Android NDK

Demo softwareDemo softwareDemo softwareDemo softwareDemo software

github.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndk

Page 7: Metasepi team meeting #8': Haskell apps on Android NDK

[2] What is Ajhc?[2] What is Ajhc?[2] What is Ajhc?[2] What is Ajhc?[2] What is Ajhc?

http://ajhc.metasepi.org/http://ajhc.metasepi.org/http://ajhc.metasepi.org/http://ajhc.metasepi.org/http://ajhc.metasepi.org/

☆ Ajhc := A fork of jhc☆ Ajhc := A fork of jhc☆ Ajhc := A fork of jhc☆ Ajhc := A fork of jhc☆ Ajhc := A fork of jhc

☆ jhc := John's Haskell Compiler☆ jhc := John's Haskell Compiler☆ jhc := John's Haskell Compiler☆ jhc := John's Haskell Compiler☆ jhc := John's Haskell Compiler

☆ http://repetae.net/computer/jhc/☆ http://repetae.net/computer/jhc/☆ http://repetae.net/computer/jhc/☆ http://repetae.net/computer/jhc/☆ http://repetae.net/computer/jhc/

☆ Jhc outputs binary that has low-memory-footprint and runs fast.☆ Jhc outputs binary that has low-memory-footprint and runs fast.☆ Jhc outputs binary that has low-memory-footprint and runs fast.☆ Jhc outputs binary that has low-memory-footprint and runs fast.☆ Jhc outputs binary that has low-memory-footprint and runs fast.

☆ Good for embedded software.☆ Good for embedded software.☆ Good for embedded software.☆ Good for embedded software.☆ Good for embedded software.

Page 8: Metasepi team meeting #8': Haskell apps on Android NDK

Who is John?Who is John?Who is John?Who is John?Who is John?

☆ John Meacham☆ John Meacham☆ John Meacham☆ John Meacham☆ John Meacham

☆ http://repetae.net/☆ http://repetae.net/☆ http://repetae.net/☆ http://repetae.net/☆ http://repetae.net/

Page 9: Metasepi team meeting #8': Haskell apps on Android NDK

Why need Ajhc?Why need Ajhc?Why need Ajhc?Why need Ajhc?Why need Ajhc?

☆ GHC is de facto standard on Haskell.☆ GHC is de facto standard on Haskell.☆ GHC is de facto standard on Haskell.☆ GHC is de facto standard on Haskell.☆ GHC is de facto standard on Haskell.

☆ GHC := Glasgow Haskell Compiler☆ GHC := Glasgow Haskell Compiler☆ GHC := Glasgow Haskell Compiler☆ GHC := Glasgow Haskell Compiler☆ GHC := Glasgow Haskell Compiler

☆ http://www.haskell.org/ghc/☆ http://www.haskell.org/ghc/☆ http://www.haskell.org/ghc/☆ http://www.haskell.org/ghc/☆ http://www.haskell.org/ghc/

☆ Why need another Haskell compiler?☆ Why need another Haskell compiler?☆ Why need another Haskell compiler?☆ Why need another Haskell compiler?☆ Why need another Haskell compiler?

☆ To develop kernel named "Metasepi".☆ To develop kernel named "Metasepi".☆ To develop kernel named "Metasepi".☆ To develop kernel named "Metasepi".☆ To develop kernel named "Metasepi".

Page 10: Metasepi team meeting #8': Haskell apps on Android NDK

[3] What is Metasepi?[3] What is Metasepi?[3] What is Metasepi?[3] What is Metasepi?[3] What is Metasepi?

http://metasepi.org/http://metasepi.org/http://metasepi.org/http://metasepi.org/http://metasepi.org/

☆ Unix-like OS designed by strong type.☆ Unix-like OS designed by strong type.☆ Unix-like OS designed by strong type.☆ Unix-like OS designed by strong type.☆ Unix-like OS designed by strong type.

☆ Using ML or more strong type lang.☆ Using ML or more strong type lang.☆ Using ML or more strong type lang.☆ Using ML or more strong type lang.☆ Using ML or more strong type lang.

Haskell http://www.haskell.org/Haskell http://www.haskell.org/Haskell http://www.haskell.org/Haskell http://www.haskell.org/Haskell http://www.haskell.org/

OCaml http://caml.inria.fr/OCaml http://caml.inria.fr/OCaml http://caml.inria.fr/OCaml http://caml.inria.fr/OCaml http://caml.inria.fr/

MLton http://mlton.org/MLton http://mlton.org/MLton http://mlton.org/MLton http://mlton.org/MLton http://mlton.org/

. . . and suchlike.. . . and suchlike.. . . and suchlike.. . . and suchlike.. . . and suchlike.

Page 11: Metasepi team meeting #8': Haskell apps on Android NDK

Why need Metasepi?Why need Metasepi?Why need Metasepi?Why need Metasepi?Why need Metasepi?

☆ We have already Linux or Windows.☆ We have already Linux or Windows.☆ We have already Linux or Windows.☆ We have already Linux or Windows.☆ We have already Linux or Windows.

☆ But the developers are suffering.☆ But the developers are suffering.☆ But the developers are suffering.☆ But the developers are suffering.☆ But the developers are suffering.

☆ If use the kernel changed by you,☆ If use the kernel changed by you,☆ If use the kernel changed by you,☆ If use the kernel changed by you,☆ If use the kernel changed by you,

☆ you will get many runtime error.☆ you will get many runtime error.☆ you will get many runtime error.☆ you will get many runtime error.☆ you will get many runtime error.

☆ Difficult even to reproduce it.☆ Difficult even to reproduce it.☆ Difficult even to reproduce it.☆ Difficult even to reproduce it.☆ Difficult even to reproduce it.

Page 12: Metasepi team meeting #8': Haskell apps on Android NDK

Doesn't OSS have good quality?Doesn't OSS have good quality?Doesn't OSS have good quality?Doesn't OSS have good quality?Doesn't OSS have good quality?

☆ "The Cathedral and the Bazaar"☆ "The Cathedral and the Bazaar"☆ "The Cathedral and the Bazaar"☆ "The Cathedral and the Bazaar"☆ "The Cathedral and the Bazaar"

☆ "Given enough eyeballs, all bugs are shallow."☆ "Given enough eyeballs, all bugs are shallow."☆ "Given enough eyeballs, all bugs are shallow."☆ "Given enough eyeballs, all bugs are shallow."☆ "Given enough eyeballs, all bugs are shallow."http://cruel.org/freeware/cathedral.htmlhttp://cruel.org/freeware/cathedral.htmlhttp://cruel.org/freeware/cathedral.htmlhttp://cruel.org/freeware/cathedral.htmlhttp://cruel.org/freeware/cathedral.html

☆ But if you develop your own product reusing OSS...☆ But if you develop your own product reusing OSS...☆ But if you develop your own product reusing OSS...☆ But if you develop your own product reusing OSS...☆ But if you develop your own product reusing OSS...

Page 13: Metasepi team meeting #8': Haskell apps on Android NDK

Low quality out of OSS umbrellaLow quality out of OSS umbrellaLow quality out of OSS umbrellaLow quality out of OSS umbrellaLow quality out of OSS umbrella

Page 14: Metasepi team meeting #8': Haskell apps on Android NDK

Type safetyType safetyType safetyType safetyType safety

☆ Less runtime errors.☆ Less runtime errors.☆ Less runtime errors.☆ Less runtime errors.☆ Less runtime errors.

☆ "数理科学的バグ撲滅方法論のすすめ"☆ "数理科学的バグ撲滅方法論のすすめ"☆ "数理科学的バグ撲滅方法論のすすめ"☆ "数理科学的バグ撲滅方法論のすすめ"☆ "数理科学的バグ撲滅方法論のすすめ"http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248230/http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248230/http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248230/http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248230/http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248230/

Page 15: Metasepi team meeting #8': Haskell apps on Android NDK

Kernel wants type desperatelyKernel wants type desperatelyKernel wants type desperatelyKernel wants type desperatelyKernel wants type desperately

☆ Kernels are developed with C lang.☆ Kernels are developed with C lang.☆ Kernels are developed with C lang.☆ Kernels are developed with C lang.☆ Kernels are developed with C lang.

☆ Error on user space => SEGV☆ Error on user space => SEGV☆ Error on user space => SEGV☆ Error on user space => SEGV☆ Error on user space => SEGV

☆ Error on kernel space => Halt!☆ Error on kernel space => Halt!☆ Error on kernel space => Halt!☆ Error on kernel space => Halt!☆ Error on kernel space => Halt!

☆ Should design kernel with the greatest care.☆ Should design kernel with the greatest care.☆ Should design kernel with the greatest care.☆ Should design kernel with the greatest care.☆ Should design kernel with the greatest care.

☆ C language is safe?☆ C language is safe?☆ C language is safe?☆ C language is safe?☆ C language is safe?

Page 16: Metasepi team meeting #8': Haskell apps on Android NDK

[4] What is compiler to build OS[4] What is compiler to build OS[4] What is compiler to build OS[4] What is compiler to build OS[4] What is compiler to build OS

☆ Need strong type.☆ Need strong type.☆ Need strong type.☆ Need strong type.☆ Need strong type.

☆ Need flexibility such as C language.☆ Need flexibility such as C language.☆ Need flexibility such as C language.☆ Need flexibility such as C language.☆ Need flexibility such as C language.

☆ Create it if there are not!☆ Create it if there are not!☆ Create it if there are not!☆ Create it if there are not!☆ Create it if there are not!

☆ From scratch? No thank you...☆ From scratch? No thank you...☆ From scratch? No thank you...☆ From scratch? No thank you...☆ From scratch? No thank you...

☆ Look for our compiler base.☆ Look for our compiler base.☆ Look for our compiler base.☆ Look for our compiler base.☆ Look for our compiler base.

Page 17: Metasepi team meeting #8': Haskell apps on Android NDK

Want POSIX free compilerWant POSIX free compilerWant POSIX free compilerWant POSIX free compilerWant POSIX free compiler

Programs to print "hoge" on terminal.Programs to print "hoge" on terminal.Programs to print "hoge" on terminal.Programs to print "hoge" on terminal.Programs to print "hoge" on terminal.

The lesser depends on POSIX, the smaller values.The lesser depends on POSIX, the smaller values.The lesser depends on POSIX, the smaller values.The lesser depends on POSIX, the smaller values.The lesser depends on POSIX, the smaller values.

Page 18: Metasepi team meeting #8': Haskell apps on Android NDK

Jhc output has only 20 undefJhc output has only 20 undefJhc output has only 20 undefJhc output has only 20 undefJhc output has only 20 undef$ nm hs.out | grep "U " U _IO_putc@@GLIBC_2.2.5 U __libc_start_main@@GLIBC_2.2.5 U _setjmp@@GLIBC_2.2.5 U abort@@GLIBC_2.2.5 U ctime@@GLIBC_2.2.5 U exit@@GLIBC_2.2.5 U fflush@@GLIBC_2.2.5 U fprintf@@GLIBC_2.2.5 U fputc@@GLIBC_2.2.5 U fputs@@GLIBC_2.2.5 U free@@GLIBC_2.2.5 U fwrite@@GLIBC_2.2.5 U getenv@@GLIBC_2.2.5 U malloc@@GLIBC_2.2.5 U memset@@GLIBC_2.2.5 U posix_memalign@@GLIBC_2.2.5 U realloc@@GLIBC_2.2.5 U setlocale@@GLIBC_2.2.5 U sysconf@@GLIBC_2.2.5 U times@@GLIBC_2.2.5

$ nm hs.out | grep "U " U _IO_putc@@GLIBC_2.2.5 U __libc_start_main@@GLIBC_2.2.5 U _setjmp@@GLIBC_2.2.5 U abort@@GLIBC_2.2.5 U ctime@@GLIBC_2.2.5 U exit@@GLIBC_2.2.5 U fflush@@GLIBC_2.2.5 U fprintf@@GLIBC_2.2.5 U fputc@@GLIBC_2.2.5 U fputs@@GLIBC_2.2.5 U free@@GLIBC_2.2.5 U fwrite@@GLIBC_2.2.5 U getenv@@GLIBC_2.2.5 U malloc@@GLIBC_2.2.5 U memset@@GLIBC_2.2.5 U posix_memalign@@GLIBC_2.2.5 U realloc@@GLIBC_2.2.5 U setlocale@@GLIBC_2.2.5 U sysconf@@GLIBC_2.2.5 U times@@GLIBC_2.2.5

$ nm hs.out | grep "U " U _IO_putc@@GLIBC_2.2.5 U __libc_start_main@@GLIBC_2.2.5 U _setjmp@@GLIBC_2.2.5 U abort@@GLIBC_2.2.5 U ctime@@GLIBC_2.2.5 U exit@@GLIBC_2.2.5 U fflush@@GLIBC_2.2.5 U fprintf@@GLIBC_2.2.5 U fputc@@GLIBC_2.2.5 U fputs@@GLIBC_2.2.5 U free@@GLIBC_2.2.5 U fwrite@@GLIBC_2.2.5 U getenv@@GLIBC_2.2.5 U malloc@@GLIBC_2.2.5 U memset@@GLIBC_2.2.5 U posix_memalign@@GLIBC_2.2.5 U realloc@@GLIBC_2.2.5 U setlocale@@GLIBC_2.2.5 U sysconf@@GLIBC_2.2.5 U times@@GLIBC_2.2.5

$ nm hs.out | grep "U " U _IO_putc@@GLIBC_2.2.5 U __libc_start_main@@GLIBC_2.2.5 U _setjmp@@GLIBC_2.2.5 U abort@@GLIBC_2.2.5 U ctime@@GLIBC_2.2.5 U exit@@GLIBC_2.2.5 U fflush@@GLIBC_2.2.5 U fprintf@@GLIBC_2.2.5 U fputc@@GLIBC_2.2.5 U fputs@@GLIBC_2.2.5 U free@@GLIBC_2.2.5 U fwrite@@GLIBC_2.2.5 U getenv@@GLIBC_2.2.5 U malloc@@GLIBC_2.2.5 U memset@@GLIBC_2.2.5 U posix_memalign@@GLIBC_2.2.5 U realloc@@GLIBC_2.2.5 U setlocale@@GLIBC_2.2.5 U sysconf@@GLIBC_2.2.5 U times@@GLIBC_2.2.5

$ nm hs.out | grep "U " U _IO_putc@@GLIBC_2.2.5 U __libc_start_main@@GLIBC_2.2.5 U _setjmp@@GLIBC_2.2.5 U abort@@GLIBC_2.2.5 U ctime@@GLIBC_2.2.5 U exit@@GLIBC_2.2.5 U fflush@@GLIBC_2.2.5 U fprintf@@GLIBC_2.2.5 U fputc@@GLIBC_2.2.5 U fputs@@GLIBC_2.2.5 U free@@GLIBC_2.2.5 U fwrite@@GLIBC_2.2.5 U getenv@@GLIBC_2.2.5 U malloc@@GLIBC_2.2.5 U memset@@GLIBC_2.2.5 U posix_memalign@@GLIBC_2.2.5 U realloc@@GLIBC_2.2.5 U setlocale@@GLIBC_2.2.5 U sysconf@@GLIBC_2.2.5 U times@@GLIBC_2.2.5

Page 19: Metasepi team meeting #8': Haskell apps on Android NDK

Jhc is translator to C languageJhc is translator to C languageJhc is translator to C languageJhc is translator to C languageJhc is translator to C language

Page 20: Metasepi team meeting #8': Haskell apps on Android NDK

Easy to cross buildEasy to cross buildEasy to cross buildEasy to cross buildEasy to cross build

Page 21: Metasepi team meeting #8': Haskell apps on Android NDK

Survive burning outSurvive burning outSurvive burning outSurvive burning outSurvive burning out

Let's develop with dogfooding style. (The method is called "Snatch".)Let's develop with dogfooding style. (The method is called "Snatch".)Let's develop with dogfooding style. (The method is called "Snatch".)Let's develop with dogfooding style. (The method is called "Snatch".)Let's develop with dogfooding style. (The method is called "Snatch".)

Page 22: Metasepi team meeting #8': Haskell apps on Android NDK

[5] How to use Ajhc[5] How to use Ajhc[5] How to use Ajhc[5] How to use Ajhc[5] How to use Ajhc

Case of Ubuntu 12.04 amd64.Case of Ubuntu 12.04 amd64.Case of Ubuntu 12.04 amd64.Case of Ubuntu 12.04 amd64.Case of Ubuntu 12.04 amd64.$ sudo apt-get install haskell-platform libncurses5-dev gcc m4$ cabal update$ export PATH=$HOME/.cabal/bin/:$PATH$ cabal install ajhc$ which ajhc/home/USER/.cabal/bin/ajhc$ echo 'main = print "hoge"' > Hoge.hs$ ajhc Hoge.hs$ ./hs.out"hoge"

$ sudo apt-get install haskell-platform libncurses5-dev gcc m4$ cabal update$ export PATH=$HOME/.cabal/bin/:$PATH$ cabal install ajhc$ which ajhc/home/USER/.cabal/bin/ajhc$ echo 'main = print "hoge"' > Hoge.hs$ ajhc Hoge.hs$ ./hs.out"hoge"

$ sudo apt-get install haskell-platform libncurses5-dev gcc m4$ cabal update$ export PATH=$HOME/.cabal/bin/:$PATH$ cabal install ajhc$ which ajhc/home/USER/.cabal/bin/ajhc$ echo 'main = print "hoge"' > Hoge.hs$ ajhc Hoge.hs$ ./hs.out"hoge"

$ sudo apt-get install haskell-platform libncurses5-dev gcc m4$ cabal update$ export PATH=$HOME/.cabal/bin/:$PATH$ cabal install ajhc$ which ajhc/home/USER/.cabal/bin/ajhc$ echo 'main = print "hoge"' > Hoge.hs$ ajhc Hoge.hs$ ./hs.out"hoge"

$ sudo apt-get install haskell-platform libncurses5-dev gcc m4$ cabal update$ export PATH=$HOME/.cabal/bin/:$PATH$ cabal install ajhc$ which ajhc/home/USER/.cabal/bin/ajhc$ echo 'main = print "hoge"' > Hoge.hs$ ajhc Hoge.hs$ ./hs.out"hoge"

You can use on Windows or Mac OS X.You can use on Windows or Mac OS X.You can use on Windows or Mac OS X.You can use on Windows or Mac OS X.You can use on Windows or Mac OS X.

Page 23: Metasepi team meeting #8': Haskell apps on Android NDK

Detail of usageDetail of usageDetail of usageDetail of usageDetail of usage

☆ Please read "Ajhc User's Manual".☆ Please read "Ajhc User's Manual".☆ Please read "Ajhc User's Manual".☆ Please read "Ajhc User's Manual".☆ Please read "Ajhc User's Manual".

ajhc.metasepi.org/manual.htmlajhc.metasepi.org/manual.htmlajhc.metasepi.org/manual.htmlajhc.metasepi.org/manual.htmlajhc.metasepi.org/manual.html

☆ Also you can read in Japanese.☆ Also you can read in Japanese.☆ Also you can read in Japanese.☆ Also you can read in Japanese.☆ Also you can read in Japanese.

ajhc.metasepi.org/manual_ja.htmlajhc.metasepi.org/manual_ja.htmlajhc.metasepi.org/manual_ja.htmlajhc.metasepi.org/manual_ja.htmlajhc.metasepi.org/manual_ja.html

Page 24: Metasepi team meeting #8': Haskell apps on Android NDK

[6] Haskell on Android NDK[6] Haskell on Android NDK[6] Haskell on Android NDK[6] Haskell on Android NDK[6] Haskell on Android NDK

github.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndkgithub.com/ajhc/demo-android-ndk

☆ First, build the demo apps.☆ First, build the demo apps.☆ First, build the demo apps.☆ First, build the demo apps.☆ First, build the demo apps.

☆ Then, see more detail of the code.☆ Then, see more detail of the code.☆ Then, see more detail of the code.☆ Then, see more detail of the code.☆ Then, see more detail of the code.

Page 25: Metasepi team meeting #8': Haskell apps on Android NDK

Setup Android SDK/NDKSetup Android SDK/NDKSetup Android SDK/NDKSetup Android SDK/NDKSetup Android SDK/NDK

☆ Download Android SDK/NDK☆ Download Android SDK/NDK☆ Download Android SDK/NDK☆ Download Android SDK/NDK☆ Download Android SDK/NDK* Android SDK (adt-bundle-linux-x86_64-20130917.zip) http://developer.android.com/sdk/index.html* Android NDK (android-ndk-r9-linux-x86_64.tar.bz2) http://developer.android.com/tools/sdk/ndk/index.html

* Android SDK (adt-bundle-linux-x86_64-20130917.zip) http://developer.android.com/sdk/index.html* Android NDK (android-ndk-r9-linux-x86_64.tar.bz2) http://developer.android.com/tools/sdk/ndk/index.html

* Android SDK (adt-bundle-linux-x86_64-20130917.zip) http://developer.android.com/sdk/index.html* Android NDK (android-ndk-r9-linux-x86_64.tar.bz2) http://developer.android.com/tools/sdk/ndk/index.html

* Android SDK (adt-bundle-linux-x86_64-20130917.zip) http://developer.android.com/sdk/index.html* Android NDK (android-ndk-r9-linux-x86_64.tar.bz2) http://developer.android.com/tools/sdk/ndk/index.html

* Android SDK (adt-bundle-linux-x86_64-20130917.zip) http://developer.android.com/sdk/index.html* Android NDK (android-ndk-r9-linux-x86_64.tar.bz2) http://developer.android.com/tools/sdk/ndk/index.html

☆ Install Android SDK/NDK☆ Install Android SDK/NDK☆ Install Android SDK/NDK☆ Install Android SDK/NDK☆ Install Android SDK/NDK$ cd $HOME$ unzip -x adt-bundle-linux-x86_64-20130917.zip$ mv adt-bundle-linux-x86_64-20130917/sdk $HOME/android-sdk$ rm -f adt-bundle-linux-x86_64-20130917$ export PATH=$PATH:$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools$ tar xf android-ndk-r9-linux-x86_64.tar.bz2$ mv android-ndk-r9 android-ndk$ export PATH=$PATH:$HOME/android-ndk$ sudo apt-get install openjdk-7-jdk ant lib32z1-dev lib32stdc++6$ android update sdk --no-ui --force

$ cd $HOME$ unzip -x adt-bundle-linux-x86_64-20130917.zip$ mv adt-bundle-linux-x86_64-20130917/sdk $HOME/android-sdk$ rm -f adt-bundle-linux-x86_64-20130917$ export PATH=$PATH:$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools$ tar xf android-ndk-r9-linux-x86_64.tar.bz2$ mv android-ndk-r9 android-ndk$ export PATH=$PATH:$HOME/android-ndk$ sudo apt-get install openjdk-7-jdk ant lib32z1-dev lib32stdc++6$ android update sdk --no-ui --force

$ cd $HOME$ unzip -x adt-bundle-linux-x86_64-20130917.zip$ mv adt-bundle-linux-x86_64-20130917/sdk $HOME/android-sdk$ rm -f adt-bundle-linux-x86_64-20130917$ export PATH=$PATH:$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools$ tar xf android-ndk-r9-linux-x86_64.tar.bz2$ mv android-ndk-r9 android-ndk$ export PATH=$PATH:$HOME/android-ndk$ sudo apt-get install openjdk-7-jdk ant lib32z1-dev lib32stdc++6$ android update sdk --no-ui --force

$ cd $HOME$ unzip -x adt-bundle-linux-x86_64-20130917.zip$ mv adt-bundle-linux-x86_64-20130917/sdk $HOME/android-sdk$ rm -f adt-bundle-linux-x86_64-20130917$ export PATH=$PATH:$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools$ tar xf android-ndk-r9-linux-x86_64.tar.bz2$ mv android-ndk-r9 android-ndk$ export PATH=$PATH:$HOME/android-ndk$ sudo apt-get install openjdk-7-jdk ant lib32z1-dev lib32stdc++6$ android update sdk --no-ui --force

$ cd $HOME$ unzip -x adt-bundle-linux-x86_64-20130917.zip$ mv adt-bundle-linux-x86_64-20130917/sdk $HOME/android-sdk$ rm -f adt-bundle-linux-x86_64-20130917$ export PATH=$PATH:$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools$ tar xf android-ndk-r9-linux-x86_64.tar.bz2$ mv android-ndk-r9 android-ndk$ export PATH=$PATH:$HOME/android-ndk$ sudo apt-get install openjdk-7-jdk ant lib32z1-dev lib32stdc++6$ android update sdk --no-ui --force

Page 26: Metasepi team meeting #8': Haskell apps on Android NDK

Start with sample C applicationStart with sample C applicationStart with sample C applicationStart with sample C applicationStart with sample C application

Sample application "native-activity".Sample application "native-activity".Sample application "native-activity".Sample application "native-activity".Sample application "native-activity".

developer.android.com/tools/sdk/ndk/developer.android.com/tools/sdk/ndk/developer.android.com/tools/sdk/ndk/developer.android.com/tools/sdk/ndk/developer.android.com/tools/sdk/ndk/

Page 27: Metasepi team meeting #8': Haskell apps on Android NDK

Build sample C applicationBuild sample C applicationBuild sample C applicationBuild sample C applicationBuild sample C application

☆ Build☆ Build☆ Build☆ Build☆ Build$ cd $HOME/android-ndk/samples/native-activity$ android update project -p ./ -n native-activity -t android-10$ ndk-build NDK_DEBUG=1$ ant debug$ file bin/native-activity-debug.apkbin/native-activity-debug.apk: Java Jar file data (zip)

$ cd $HOME/android-ndk/samples/native-activity$ android update project -p ./ -n native-activity -t android-10$ ndk-build NDK_DEBUG=1$ ant debug$ file bin/native-activity-debug.apkbin/native-activity-debug.apk: Java Jar file data (zip)

$ cd $HOME/android-ndk/samples/native-activity$ android update project -p ./ -n native-activity -t android-10$ ndk-build NDK_DEBUG=1$ ant debug$ file bin/native-activity-debug.apkbin/native-activity-debug.apk: Java Jar file data (zip)

$ cd $HOME/android-ndk/samples/native-activity$ android update project -p ./ -n native-activity -t android-10$ ndk-build NDK_DEBUG=1$ ant debug$ file bin/native-activity-debug.apkbin/native-activity-debug.apk: Java Jar file data (zip)

$ cd $HOME/android-ndk/samples/native-activity$ android update project -p ./ -n native-activity -t android-10$ ndk-build NDK_DEBUG=1$ ant debug$ file bin/native-activity-debug.apkbin/native-activity-debug.apk: Java Jar file data (zip)

☆ Flash to your Android device☆ Flash to your Android device☆ Flash to your Android device☆ Flash to your Android device☆ Flash to your Android device$ sudo adb devices* daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached015d4906053c1605 device$ sudo adb install -r bin/native-activity-debug.apk1221 KB/s (156823 bytes in 0.125s) pkg: /data/local/tmp/native-activity-debug.apkSuccess

$ sudo adb devices* daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached015d4906053c1605 device$ sudo adb install -r bin/native-activity-debug.apk1221 KB/s (156823 bytes in 0.125s) pkg: /data/local/tmp/native-activity-debug.apkSuccess

$ sudo adb devices* daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached015d4906053c1605 device$ sudo adb install -r bin/native-activity-debug.apk1221 KB/s (156823 bytes in 0.125s) pkg: /data/local/tmp/native-activity-debug.apkSuccess

$ sudo adb devices* daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached015d4906053c1605 device$ sudo adb install -r bin/native-activity-debug.apk1221 KB/s (156823 bytes in 0.125s) pkg: /data/local/tmp/native-activity-debug.apkSuccess

$ sudo adb devices* daemon not running. starting it now on port 5037 ** daemon started successfully *List of devices attached015d4906053c1605 device$ sudo adb install -r bin/native-activity-debug.apk1221 KB/s (156823 bytes in 0.125s) pkg: /data/local/tmp/native-activity-debug.apkSuccess

Page 28: Metasepi team meeting #8': Haskell apps on Android NDK

Build Haskell applicationsBuild Haskell applicationsBuild Haskell applicationsBuild Haskell applicationsBuild Haskell applications

☆ Checkout the source code.☆ Checkout the source code.☆ Checkout the source code.☆ Checkout the source code.☆ Checkout the source code.$ git clone https://github.com/ajhc/demo-android-ndk.git$ cd demo-android-ndk$ git clone https://github.com/ajhc/demo-android-ndk.git$ cd demo-android-ndk$ git clone https://github.com/ajhc/demo-android-ndk.git$ cd demo-android-ndk$ git clone https://github.com/ajhc/demo-android-ndk.git$ cd demo-android-ndk$ git clone https://github.com/ajhc/demo-android-ndk.git$ cd demo-android-ndk

☆ Build☆ Build☆ Build☆ Build☆ Build$ make$ find . -name "*.hl"./lib/android-ndk-0.1.hl$ find . -name "*debug.apk"./cube/bin/cube-debug.apk./native-activity/bin/native-activity-debug.apk

$ make$ find . -name "*.hl"./lib/android-ndk-0.1.hl$ find . -name "*debug.apk"./cube/bin/cube-debug.apk./native-activity/bin/native-activity-debug.apk

$ make$ find . -name "*.hl"./lib/android-ndk-0.1.hl$ find . -name "*debug.apk"./cube/bin/cube-debug.apk./native-activity/bin/native-activity-debug.apk

$ make$ find . -name "*.hl"./lib/android-ndk-0.1.hl$ find . -name "*debug.apk"./cube/bin/cube-debug.apk./native-activity/bin/native-activity-debug.apk

$ make$ find . -name "*.hl"./lib/android-ndk-0.1.hl$ find . -name "*debug.apk"./cube/bin/cube-debug.apk./native-activity/bin/native-activity-debug.apk

☆ "hl" suffix file: Ajhc library☆ "hl" suffix file: Ajhc library☆ "hl" suffix file: Ajhc library☆ "hl" suffix file: Ajhc library☆ "hl" suffix file: Ajhc library

☆ "apk" suffix file: Android application☆ "apk" suffix file: Android application☆ "apk" suffix file: Android application☆ "apk" suffix file: Android application☆ "apk" suffix file: Android application

Page 29: Metasepi team meeting #8': Haskell apps on Android NDK

Source code treeSource code treeSource code treeSource code treeSource code treedemo-android-ndk|-- lib # Framework library| `-- android-ndk| |-- AndroidNdk| | |-- EGL.hs| | |-- OpenGLES.hs| | `-- Storable.hs| |-- AndroidNdk.hs| `-- android-ndk.yaml|-- cube ... # Application`-- native-activity # Application |-- AndroidManifest.xml |-- hs_src | `-- Main.hs # Haskell code on application side |-- jni | |-- Android.mk | |-- Application.mk | |-- c_extern.h | |-- dummy4jhc.c # Stub code for Ajhc runtime | `-- main.c # C language code to kick Haskell code `-- res `-- values `-- strings.xml

demo-android-ndk|-- lib # Framework library| `-- android-ndk| |-- AndroidNdk| | |-- EGL.hs| | |-- OpenGLES.hs| | `-- Storable.hs| |-- AndroidNdk.hs| `-- android-ndk.yaml|-- cube ... # Application`-- native-activity # Application |-- AndroidManifest.xml |-- hs_src | `-- Main.hs # Haskell code on application side |-- jni | |-- Android.mk | |-- Application.mk | |-- c_extern.h | |-- dummy4jhc.c # Stub code for Ajhc runtime | `-- main.c # C language code to kick Haskell code `-- res `-- values `-- strings.xml

demo-android-ndk|-- lib # Framework library| `-- android-ndk| |-- AndroidNdk| | |-- EGL.hs| | |-- OpenGLES.hs| | `-- Storable.hs| |-- AndroidNdk.hs| `-- android-ndk.yaml|-- cube ... # Application`-- native-activity # Application |-- AndroidManifest.xml |-- hs_src | `-- Main.hs # Haskell code on application side |-- jni | |-- Android.mk | |-- Application.mk | |-- c_extern.h | |-- dummy4jhc.c # Stub code for Ajhc runtime | `-- main.c # C language code to kick Haskell code `-- res `-- values `-- strings.xml

demo-android-ndk|-- lib # Framework library| `-- android-ndk| |-- AndroidNdk| | |-- EGL.hs| | |-- OpenGLES.hs| | `-- Storable.hs| |-- AndroidNdk.hs| `-- android-ndk.yaml|-- cube ... # Application`-- native-activity # Application |-- AndroidManifest.xml |-- hs_src | `-- Main.hs # Haskell code on application side |-- jni | |-- Android.mk | |-- Application.mk | |-- c_extern.h | |-- dummy4jhc.c # Stub code for Ajhc runtime | `-- main.c # C language code to kick Haskell code `-- res `-- values `-- strings.xml

demo-android-ndk|-- lib # Framework library| `-- android-ndk| |-- AndroidNdk| | |-- EGL.hs| | |-- OpenGLES.hs| | `-- Storable.hs| |-- AndroidNdk.hs| `-- android-ndk.yaml|-- cube ... # Application`-- native-activity # Application |-- AndroidManifest.xml |-- hs_src | `-- Main.hs # Haskell code on application side |-- jni | |-- Android.mk | |-- Application.mk | |-- c_extern.h | |-- dummy4jhc.c # Stub code for Ajhc runtime | `-- main.c # C language code to kick Haskell code `-- res `-- values `-- strings.xml

Page 30: Metasepi team meeting #8': Haskell apps on Android NDK

Build process on MakefileBuild process on MakefileBuild process on MakefileBuild process on MakefileBuild process on Makefile

Page 31: Metasepi team meeting #8': Haskell apps on Android NDK

[7] Status report of framework[7] Status report of framework[7] Status report of framework[7] Status report of framework[7] Status report of framework

Let's see "native-activity" demo internal.Let's see "native-activity" demo internal.Let's see "native-activity" demo internal.Let's see "native-activity" demo internal.Let's see "native-activity" demo internal.

But, the framework has no stability yet.But, the framework has no stability yet.But, the framework has no stability yet.But, the framework has no stability yet.But, the framework has no stability yet.

Page 32: Metasepi team meeting #8': Haskell apps on Android NDK

Architecture: Using C languageArchitecture: Using C languageArchitecture: Using C languageArchitecture: Using C languageArchitecture: Using C language

Page 33: Metasepi team meeting #8': Haskell apps on Android NDK

Architecture: Using HaskellArchitecture: Using HaskellArchitecture: Using HaskellArchitecture: Using HaskellArchitecture: Using Haskell

Page 34: Metasepi team meeting #8': Haskell apps on Android NDK

Code #1: ImportsCode #1: ImportsCode #1: ImportsCode #1: ImportsCode #1: Imports

Page 35: Metasepi team meeting #8': Haskell apps on Android NDK

Code #2: Some magicCode #2: Some magicCode #2: Some magicCode #2: Some magicCode #2: Some magic

Page 36: Metasepi team meeting #8': Haskell apps on Android NDK

Code #3: Main entryCode #3: Main entryCode #3: Main entryCode #3: Main entryCode #3: Main entry

Page 37: Metasepi team meeting #8': Haskell apps on Android NDK

Code #4: Handle inputsCode #4: Handle inputsCode #4: Handle inputsCode #4: Handle inputsCode #4: Handle inputs

Page 38: Metasepi team meeting #8': Haskell apps on Android NDK

Code #5: Handle cmdsCode #5: Handle cmdsCode #5: Handle cmdsCode #5: Handle cmdsCode #5: Handle cmds

Page 39: Metasepi team meeting #8': Haskell apps on Android NDK

Code #6: Draw frameCode #6: Draw frameCode #6: Draw frameCode #6: Draw frameCode #6: Draw frame

Page 40: Metasepi team meeting #8': Haskell apps on Android NDK

Code #7: Init displayCode #7: Init displayCode #7: Init displayCode #7: Init displayCode #7: Init display

Page 41: Metasepi team meeting #8': Haskell apps on Android NDK

PR: Call For ArticlesPR: Call For ArticlesPR: Call For ArticlesPR: Call For ArticlesPR: Call For Articles

☆ http://www.paraiso-lang.org/ikmsm/☆ http://www.paraiso-lang.org/ikmsm/☆ http://www.paraiso-lang.org/ikmsm/☆ http://www.paraiso-lang.org/ikmsm/☆ http://www.paraiso-lang.org/ikmsm/

☆ Fanzine of functional programming.☆ Fanzine of functional programming.☆ Fanzine of functional programming.☆ Fanzine of functional programming.☆ Fanzine of functional programming.

☆ About Haskell or OCaml or . . .☆ About Haskell or OCaml or . . .☆ About Haskell or OCaml or . . .☆ About Haskell or OCaml or . . .☆ About Haskell or OCaml or . . .

☆ Article about Ajhc in C84 book.☆ Article about Ajhc in C84 book.☆ Article about Ajhc in C84 book.☆ Article about Ajhc in C84 book.☆ Article about Ajhc in C84 book.

☆ Call me if you read it!☆ Call me if you read it!☆ Call me if you read it!☆ Call me if you read it!☆ Call me if you read it!http://www.paraiso-lang.org/ikmsm/books/c85.htmlhttp://www.paraiso-lang.org/ikmsm/books/c85.htmlhttp://www.paraiso-lang.org/ikmsm/books/c85.htmlhttp://www.paraiso-lang.org/ikmsm/books/c85.htmlhttp://www.paraiso-lang.org/ikmsm/books/c85.html

>>>>>