# Compiling the MUA mutt and making a click app of it (UNFINISHED)

We compile the MUA 'mutt' in the same jail as used above. It requires some more dev infrastructure:

```
# apt-get install libncursesw5-dev
```

```
phablet@ubuntu-phablet:~$ sudo chroot myRoot
root@ubuntu-phablet:/# su phablet
phablet@ubuntu-phablet:/$ cd
phablet@ubuntu-phablet:~$ cd mutt-1.5.23
phablet@ubuntu-phablet:~/mutt-1.5.23$
```

I configured mutt with the following values (in a small script c.sh):

```
$ cat c.sh
./configure --with-curses --with-sasl=/usr --disable-fcntl 
            --with-ssl=/usr --enable-external-dotlock --enable-pop 
            --enable-imap --disable-warnings --disable-flock 
            --enable-locales-fix --with-idn=no --disable-gpgme --enable-smtp 
            --enable-debug
$ make clean ; sh c.sh && make
```

the resulting bin needs the following shared libs:

```
$ ldd ./mutt
    libncursesw.so.5 => /lib/arm-linux-gnueabihf/libncursesw.so.5 (0xb6f9b000)
    libtinfo.so.5 => /lib/arm-linux-gnueabihf/libtinfo.so.5 (0xb6f70000)
    libssl.so.1.0.0 => /lib/arm-linux-gnueabihf/libssl.so.1.0.0 (0xb6f29000)
    libcrypto.so.1.0.0 => /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0xb6e11000)
    libsasl2.so.2 => /usr/lib/arm-linux-gnueabihf/libsasl2.so.2 (0xb6df0000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6d02000)
    /lib/ld-linux-armhf.so.3 (0xb6fde000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6cee000)
```

and in addition (via libdl.so.2):

```
$ ls -l /usr/lib/arm-linux-gnueabihf/sasl2/
total 148
lrwxrwxrwx 1 root root    22 mar 10 10:15 libanonymous.so -> libanonymous.so.2.0.25
lrwxrwxrwx 1 root root    22 mar 10 10:15 libanonymous.so.2 -> libanonymous.so.2.0.25
-rw-r--r-- 1 root root 13728 mar 10 10:15 libanonymous.so.2.0.25
lrwxrwxrwx 1 root root    20 mar 10 10:15 libcrammd5.so -> libcrammd5.so.2.0.25
lrwxrwxrwx 1 root root    20 mar 10 10:15 libcrammd5.so.2 -> libcrammd5.so.2.0.25
-rw-r--r-- 1 root root 13740 mar 10 10:15 libcrammd5.so.2.0.25
lrwxrwxrwx 1 root root    22 mar 10 10:15 libdigestmd5.so -> libdigestmd5.so.2.0.25
lrwxrwxrwx 1 root root    22 mar 10 10:15 libdigestmd5.so.2 -> libdigestmd5.so.2.0.25
-rw-r--r-- 1 root root 38524 mar 10 10:15 libdigestmd5.so.2.0.25
lrwxrwxrwx 1 root root    18 mar 10 10:15 liblogin.so -> liblogin.so.2.0.25
lrwxrwxrwx 1 root root    18 mar 10 10:15 liblogin.so.2 -> liblogin.so.2.0.25
-rw-r--r-- 1 root root 13728 mar 10 10:15 liblogin.so.2.0.25
lrwxrwxrwx 1 root root    17 mar 10 10:15 libntlm.so -> libntlm.so.2.0.25
lrwxrwxrwx 1 root root    17 mar 10 10:15 libntlm.so.2 -> libntlm.so.2.0.25
-rw-r--r-- 1 root root 21924 mar 10 10:15 libntlm.so.2.0.25
lrwxrwxrwx 1 root root    18 mar 10 10:15 libplain.so -> libplain.so.2.0.25
lrwxrwxrwx 1 root root    18 mar 10 10:15 libplain.so.2 -> libplain.so.2.0.25
-rw-r--r-- 1 root root 13728 mar 10 10:15 libplain.so.2.0.25
lrwxrwxrwx 1 root root    19 mar 10 10:15 libsasldb.so -> libsasldb.so.2.0.25
lrwxrwxrwx 1 root root    19 mar 10 10:15 libsasldb.so.2 -> libsasldb.so.2.0.25
-rw-r--r-- 1 root root 17744 mar 10 10:15 libsasldb.so.2.0.2
```

We move out of jail and create a top level dir for our new 'app'

```
phablet@ubuntu-phablet:~$ mkdir ~/mutt.clico
phablet@ubuntu-phablet:~$ cp -p myRoot/home/phablet/mutt-1.5.23/mutt  ~/mutt.clico
phablet@ubuntu-phablet:~$ cp -p myRoot/home/phablet/mutt-1.5.23/mutt_dotlock  ~/mutt.clico
```

In addition we need some files and the above mentioned shared libs below \~/mutt.clico:

```
phablet@ubuntu-phablet:~$ find mutt.click/
mutt.click/
mutt.click/lib
mutt.click/lib/arm-linux-gnueabihf
mutt.click/lib/arm-linux-gnueabihf/libanonymous.so
mutt.click/lib/arm-linux-gnueabihf/libanonymous.so.2
...
mutt.click/lib/arm-linux-gnueabihf/libpython2.7.so.1.0
mutt.click/lib/arm-linux-gnueabihf/libsasl2.so.2
mutt.click/.muttrc
mutt.click/mutt_dotlock
mutt.click/mutt
mutt.click/Mail
mutt.click/tmp
mutt.click/.mutt-mail_aliases
mutt.click/signature
mutt.click/.mailcap
mutt.click/mutt.sh

mutt.click/evolution-mail.svg
mutt.click/ubuntu-mutt-app.desktop
mutt.click/ubuntu-mutt-app.json
mutt.click/manifest.json
```

The file mutt.sh sirves later to launch mutt with the correct environment:

```
#!/bin/sh
# to run the MUA mutt which we have compiled in a jail below /home/phablet/myRoot
# from outside the jail

LD_LIBRARY_PATH=/home/phablet/mutt.click/lib/arm-linux-gnueabihf
export LD_LIBRARY_PATH

SASL_PATH=/home/phablet/mutt.click/lib/arm-linux-gnueabihf
export SASL_PATH

MUTT=/home/phablet/mutt.click/mutt

cd
$MUTT -F ./.muttrc
```

With a well constructed .muttrc file it works fine to read (IMAPS) and send (SMTP AUTH) mails.

We even tried zo build our 1st 'click app' from this: construct the requested files:

```
mutt.click/evolution-mail.svg
mutt.click/ubuntu-mutt-app.desktop
mutt.click/ubuntu-mutt-app.json
mutt.click/manifest.json
```

and run:

```
# click build mutt.click
Successfully built package in './com.ubuntu.developer.mapitz.ubuntu-mutt-app_0.1_all.click'.
```

install it with:

```
$ pkcon --allow-untrusted install-local  com.ubuntu.developer.mapitz.ubuntu-mutt-app_0.1_all.click
Instalando archivos           [=========================]         
Finalizado                    [=========================]         
Instalando archivos           [=========================]         
Esperando autenticación      [=========================]         
Comenzando                    [=========================]         
Finalizado                    [=========================]         
Instalado       com.ubuntu.developer.mapitz.ubuntu-mutt-app-0.1. (installed:click,removable=1,app_name=ubuntu-mutt-app)    summary goes here
```

and try to register is (which fails):

```
$ sudo click udo click register --user=phablet com.ubuntu.mutt-terminal_0.1._multiegister --user=phablet com.ubuntu.developer.mapitz.ubuntu-mutt-app 0.1

** (process:1270): WARNING **: Desktop file '/opt/click.ubuntu.com/.click/users/phablet/com.ubuntu.developer.mapitz.ubuntu-mutt-app/ubuntu-mutt-app.desktop' is set to run in a terminal, not copying
```

after changing in the file mutt.click/ubuntu-mutt-app.desktop Terminal=false

the register goes fine, the icon is in the Applications but does not work because there is no way to start a click app which needs a terminal to run inside :-(

<https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1484412>

```
$ sudo click unregister com.ubuntu.developer.mapitz.ubuntu-mutt-app 0.1
```

Last updated: Sat Oct 17 16:11:03 CEST 2015


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guru-1.gitbook.io/bq-aquaris-e-4-5-ubuntu-phone/en/chapter29.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
