unispeech / asterisk-unimrcp

UniMRCP modules for Asterisk
http://www.unimrcp.org/asterisk
GNU General Public License v2.0
48 stars 36 forks source link

Add support for custom dir layout #1

Open seamus-45 opened 9 years ago

seamus-45 commented 9 years ago

Greetings, I am a user of Alpine Linux I compiled asterisk, unimrcp and asterisk-unimrcp from source. Unimrcp has support for dir layout configuration. I edited config.layout/dirlayout.xml and add LSB layout configuration, then configure with --prefix=/usr --enable-layout=lsb. Everything work flawlessly. But asterisk-unimrcp module pays no attention to these settings, and cannot load config unimrcpclient.xml. After some digging, I realized that the module uses apt_default_dir_layout_create function and without patching code no chance to get what I want.

My current layout is:

var value
confdir /etc/unimrcp
plugindir /usr/lib/unimrcp
logdir /var/log
datadir /usr/share/unimrcp
vardir /var/run/unimrcp

P.S. Unfortunately Alpine Linux build system prevents to isntall packages in other places than /{,usr}, e.g. /opt/unimrcp or /usr/local/unimrcp. I guess this is due to the fact that the Alpine is very simple and built on musl.

achaloyan commented 9 years ago

Greetings,

Thanks for trying out directory layout options available for UniMRCP. You are right the Asterisk module uses the default layout. If you can take a closer look and make the necessary changes, I'd be glad to push them upstream. Feel free to ask for help, if needed.

seamus-45 commented 9 years ago

I would be happy to help, but do not have any experience with C or GNU Build System. My current dirty solution is hardcode my layout in a apt_default_dir_layout_create function. So we need a volunteer.

adamgoose commented 7 years ago

@seamus-45 I'm using the latest alpine docker image, and can apk add asterisk. However, when trying to build unimrcp deps from source, I get the following...

...
/bin/bash /opt/unimrcp-deps-1.4.0/libs/apr/libtool --silent --mode=compile gcc -g -O2   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./inc
lude -I/opt/unimrcp-deps-1.4.0/libs/apr/include/arch/unix -I./include/arch/unix -I/opt/unimrcp-deps-1.4.0/libs/apr/include/arch/unix -I/opt/unimrcp-d
eps-1.4.0/libs/apr/include -I/opt/unimrcp-deps-1.4.0/libs/apr/include/private  -o threadproc/unix/thread.lo -c threadproc/unix/thread.c && touch thre
adproc/unix/thread.lo
threadproc/unix/thread.c: In function 'apr_thread_name_set':
threadproc/unix/thread.c:339:46: error: missing binary operator before token "("
 #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 12)
                                              ^
make[1]: *** [/opt/unimrcp-deps-1.4.0/libs/apr/build/apr_rules.mk:206: threadproc/unix/thread.lo] Error 1
make[1]: Leaving directory '/opt/unimrcp-deps-1.4.0/libs/apr'
make: *** [/opt/unimrcp-deps-1.4.0/libs/apr/build/apr_rules.mk:118: all-recursive] Error 1

Any thoughts on this? it looks like there's a bug in the patched version of the deps. Perhaps I should be installing the deps in a different manner?

achaloyan commented 7 years ago

I do not see anything apparently wrong on the error line. What is the version of gcc on your Linux distribution. And more interestingly, how is __GLIBC_PREREQ() defined in features.h typically located in /usr/include directory. Below is a relevant part matching glibc 2.12.

/ Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. /

define GLIBC 2

define __GLIBC_MINOR__ 12

define __GLIBC_PREREQ(maj, min) \

    ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
seamus-45 commented 7 years ago

@adamgoose As I mentioned above, Alpine is built on musl but not on glibc. Thus you will not be able to build unpatched apr bundled with unimrcp-deps package. Instead of this, you should build every dependency separately and use patched apr/apr-util from aports. Overall, I have achieved this success, but many time ago. Below you can see versions which I used:

x x
aports 3.2-stable
apr(aports) 1.5.1
apr-util(aports) 1.5.4
asterisk(aports) 13.3.2
unimrcp 1.3.0
asterisk-unimrcp 1.3.1
sofia-sip 1.12.11 (g8cb7baa)

It is somewhat difficult, because you will have to write APKBUILD by yourself. Good luck!