Axel <http://alioth.debian.org/frs/download.php/3015/axel-2.4.tar.gz> is an
opensource download manager and now, i want to port it to android. But, i
am new in android-ndk. I know how to create native shared library, but i
don't know how to compile and use third party shared library. So, for my
first project, i want to do this. The first and basically thing, that i
want to know, is "WHAT SHOULD I DO?". Thanks to any one who will help me.
It is the files list of axel :
*axel.h/axel.c*
*conf.h/conf.c*
*conn.h/conn.c*
*ftp.h/ftp.c*
*http.h/http.c*
*search.h/search.c*
*tcp.h/tcp.c*
*text.c*
*Makefile*
*configure*
Configure file contents is as follow :
#!/bin/sh
###########################
## Configurer for Axel ##
## ##
## Copyright 2001 Lintux ##
###########################
prefix='/usr/local'
bindir='$prefix/bin'
etcdir='$prefix/etc'
sharedir='$prefix/share'
mandir='$sharedir/man'
locale='$sharedir/locale'
i18n=1
debug=0
strip=1
arch=`uname -s`
while [ -n "$1" ]; do
e="`expr "$1" : '--\(.*=.*\)'`"
if [ -z "$e" ]; then
cat<<EOF
Axel configure
Usage: $0 [OPTIONS]
Option Description Default
--prefix=... Directories to put files in $prefix
--bindir=... $bindir
--etcdir=... $etcdir
--mandir=... $mandir
--locale=... $locale
--i18n=0/1 Disable/enable internationalization $i18n
--debug=0/1 Disable/enable debugging $debug
--strip=0/1 Disable/enable binary stripping $strip
EOF
exit;
fi
keyname=$(expr "$e" : '\(.*\)=.*' | sed 's/[^a-z0-9_]/_/g')
value=$(expr "$e" : '.*=\(.*\)' | sed "s/'/_/g")
eval "$keyname='$value'"
shift;
done
# Expand $prefix
bindir=`eval echo $bindir`
etcdir=`eval echo $etcdir`
sharedir=`eval echo $sharedir`
mandir=`eval echo $mandir`
locale=`eval echo $locale`
if test "$etcdir" = "/usr/etc"; then
# FHS explicitely forbids /usr/etc
etcdir='/etc'
fi
cat<<EOF>Makefile.settings
## Axel settings, generated by configure
PREFIX=$prefix
BINDIR=$bindir
ETCDIR=$etcdir
SHAREDIR=$sharedir
MANDIR=$mandir
LOCALE=$locale
OUTFILE=axel
ARCH=$arch
DESTDIR=
LFLAGS=
EOF
cat<<EOF>config.h
/* Axel settings, generated by configure */
#define _REENTRANT
#define _THREAD_SAFE
#define ETCDIR "$etcdir"
#define LOCALE "$locale"
#define ARCH "$arch"
EOF
if [ "$i18n" = "1" ]; then
if type msgfmt > /dev/null 2> /dev/null; then :;else
echo 'WARNING: Internationalization disabled, you don'\''t
have the necessary files'
echo ' installed.'
echo ''
i18n=0;
fi;
fi
echo "CFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os ${CFLAGS}" >>
Makefile.settings
if [ "$debug" = "1" ]; then
echo 'CFLAGS+=-g' >> Makefile.settings
echo 'DEBUG=1' >> Makefile.settings
echo '#define DEBUG' >> config.h;
fi
if [ "$i18n" = "1" ]; then
echo 'I18N=1' >> Makefile.settings
echo '#define I18N' >> config.h
if cat /usr/local/include/libintl.h > /dev/null 2> /dev/null; then
echo 'CFLAGS+=-I/usr/local/include' >> Makefile.settings
echo 'LFLAGS+=-L/usr/local/lib' >> Makefile.settings;
fi;
fi
if [ "${CC}" != "" ]; then
echo "CC=${CC}" >> Makefile.settings;
elif type gcc > /dev/null 2> /dev/null; then
echo "CC=gcc" >> Makefile.settings;
elif type cc > /dev/null 2> /dev/null; then
echo "CC=cc" >> Makefile.settings;
else
echo 'Cannot find a C compiler, aborting.'
exit 1;
fi
if [ "$strip" = 0 ]; then
echo "STRIP=\# skip strip" >> Makefile.settings;
else
echo 'The strip option is enabled. This should not be a problem
usually, but on some'
echo 'systems it breaks stuff.'
echo
if [ "$debug" = 1 ]; then
echo 'Stripping binaries does not make sense when
debugging. Stripping disabled.'
echo
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
elif type strip > /dev/null 2> /dev/null; then
echo "STRIP=strip" >> Makefile.settings;
elif /bin/test -x /usr/ccs/bin/strip; then
echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
else
echo 'No strip utility found, cannot remove unnecessary
parts from executable.'
echo ''
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
fi;
fi
case "$arch" in
FreeBSD )
echo '#define NOGETOPTLONG' >> config.h
echo 'LFLAGS+=-pthread' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'Please keep in mind that you need GNU make to make Axel!'
echo ''
;;
OpenBSD )
echo '#define NOGETOPTLONG' >> config.h
echo 'LFLAGS+=-pthread' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'Please keep in mind that you need GNU make to make Axel!'
echo ''
;;
NetBSD )
echo 'WARNING: NetBSD not tested! Using OpenBSD settings.'
echo ' Please send me your results so I can update this!'
echo ''
echo '#define NOGETOPTLONG' >> config.h
echo 'LFLAGS+=-pthread' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'Please keep in mind that you need GNU make to make Axel!'
echo ''
;;
Darwin )
echo '#define NOGETOPTLONG' >> config.h
echo 'LFLAGS+=-lpthread' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo '#define DARWIN' >> config.h
echo 'Please keep in mind that you need GNU make to make Axel!'
echo ''
;;
Linux | GNU/kFreeBSD)
echo 'LFLAGS+=-lpthread' >> Makefile.settings
;;
SunOS )
echo '#define NOGETOPTLONG' >> config.h
echo '#define BSD_COMP' >> config.h
echo 'LFLAGS+=-lpthread -lsocket -lnsl' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'Please keep in mind that you need GNU make to make Axel!'
echo ''
;;
CYGWIN_* )
echo 'LFLAGS+=-lpthread' >> Makefile.settings
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'OUTFILE=axel.exe' >> Makefile.settings
;;
* )
echo 'LFLAGS+=-lpthread' >> Makefile.settings
echo '#define NOGETOPTLONG' >> config.h
if [ "$i18n" = "1" ]; then
echo 'LFLAGS+=-lintl' >> Makefile.settings;
fi
echo 'WARNING: This architecture is unknown!'
echo ''
echo 'That does not mean Axel will not work, it just means I'\''ve
never had the chance'
echo 'to test Axel on it. It'\''d be a great help if you could send
me more information'
echo 'about your platform so I can add it to the build tools.'
echo 'You can try to build the program now, if you wish, this
default setup might'
echo 'just work.'
echo ''
;;
esac
echo 'Configuration done:'
if [ "$i18n" = "1" ]; then
echo ' Internationalization enabled.';
else
echo ' Internationalization disabled.';
fi
if [ "$debug" = "1" ]; then
echo ' Debugging enabled.';
else
echo ' Debugging disabled.';
fi
if [ "$strip" = "1" ]; then
echo ' Binary stripping enabled.';
else
echo ' Binary stripping disabled.';
fi
Makefile content is come in following :
###########################
## Makefile for Axel ##
## ##
## Copyright 2001 Lintux ##
###########################
### DEFINITIONS
-include Makefile.settings
.SUFFIXES: .po .mo
# Add your translation here..
MOFILES = nl.mo de.mo ru.mo zh_CN.mo
all: $(OUTFILE)
install: install-bin install-etc install-man
uninstall: uninstall-bin uninstall-etc uninstall-man
ifdef I18N
all: $(MOFILES)
install: install-i18n
uninstall: uninstall-i18n
endif
clean:
rm -f *.o $(OUTFILE) search core *.mo
distclean: clean
rm -f Makefile.settings config.h axel-*.tar axel-*.tar.gz
axel-*.tar.bz2
install-man:
mkdir -p $(DESTDIR)$(MANDIR)/man1/
cp axel.1 $(DESTDIR)$(MANDIR)/man1/axel.1
mkdir -p $(DESTDIR)$(MANDIR)/zh_CN/man1/
cp axel_zh_CN.1 $(DESTDIR)$(MANDIR)/zh_CN/man1/axel.1
uninstall-man:
rm -f $(MANDIR)/man1/axel.1
rm -f $(MANDIR)/zh_CN/man1/axel.1
install-etc:
mkdir -p $(DESTDIR)$(ETCDIR)/
cp axelrc.example $(DESTDIR)$(ETCDIR)/axelrc
uninstall-etc:
rm -f $(ETCDIR)/axelrc
### MAIN PROGRAM
$(OUTFILE): axel.o conf.o conn.o ftp.o http.o search.o tcp.o text.o
$(CC) *.o -o $(OUTFILE) $(LFLAGS)
ifndef DEBUG
-$(STRIP) $(OUTFILE)
endif
.c.o:
$(CC) -c $*.c -o $*.o -Wall $(CFLAGS)
install-bin:
mkdir -p $(DESTDIR)$(BINDIR)/
cp $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE)
uninstall-bin:
rm -f $(BINDIR)/$(OUTFILE)
tar:
version=$$(sed -n 's/#define AXEL_VERSION_STRING[
\t]*"\([^"]*\)"/\1/p' < axel.h) && \
tar --create --transform "s#^#axel-$${version}/#"
"--file=axel-$${version}.tar" --exclude-vcs -- *.c *.h *.po *.1 configure
Makefile axelrc.example gui API CHANGES COPYING CREDITS README && \
gzip --best < "axel-$${version}.tar" > "axel-$${version}.tar.gz" &&
\
bzip2 --best < "axel-$${version}.tar" > "axel-$${version}.tar.bz2"
### I18N FILES
%.po:
-@mv $@ [email protected]
xgettext -k_ -o$@ *.[ch]
@if [ -e [email protected] ]; then \
echo -n Merging files...; \
msgmerge -vo [email protected] [email protected] $@; \
rm -f $@ [email protected]; \
mv [email protected] $@; \
fi
.po.mo: [email protected]
msgfmt -vo $@ $*.po
install-i18n:
@echo Installing locale files...
@for i in $(MOFILES); do \
mkdir -p $(DESTDIR)$(LOCALE)/`echo $$i | cut -d.
-f1`/LC_MESSAGES/; \
cp $$i $(DESTDIR)$(LOCALE)/`echo $$i | cut -d.
-f1`/LC_MESSAGES/axel.mo; \
done
uninstall-i18n:
cd $(LOCALE); find . -name axel.mo -exec 'rm' '{}' ';'
What should i do? What things should i know ? I should use the gcc for
compile and create shared library ? If yes, how ?
Thanks for your attention,
Best Regards,
Hossein
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en