2009-06-02 21:02:02 +02:00
|
|
|
# Google Android makefile for curl and libcurl
|
2009-09-16 00:35:49 +02:00
|
|
|
#
|
2009-06-02 21:02:02 +02:00
|
|
|
# Place the curl source (including this makefile) into external/curl/ in the
|
|
|
|
# Android source tree. Then build them with 'make curl' or just 'make libcurl'
|
2011-11-17 02:11:31 +01:00
|
|
|
# from the Android root. Tested with Android versions 1.5, 2.1-2.3
|
2009-06-02 21:02:02 +02:00
|
|
|
#
|
2009-07-14 15:30:24 +02:00
|
|
|
# Note: you must first create a curl_config.h file by running configure in the
|
2009-09-16 00:35:49 +02:00
|
|
|
# Android environment. The only way I've found to do this is tricky. Perform a
|
|
|
|
# normal Android build with libcurl in the source tree, providing the target
|
|
|
|
# "showcommands" to make. The build will eventually fail (because curl_config.h
|
|
|
|
# doesn't exist yet), but the compiler commands used to build curl will be
|
|
|
|
# shown. Now, from the external/curl/ directory, run curl's normal configure
|
|
|
|
# command with flags that match what Android itself uses. This will mean
|
|
|
|
# putting the compiler directory into the PATH, putting the -I, -isystem and
|
2010-07-10 01:11:36 +02:00
|
|
|
# -D options into CPPFLAGS, putting the -W, -m, -f, -O and -nostdlib options
|
|
|
|
# into CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the
|
|
|
|
# path to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o.
|
|
|
|
# Remember that the paths must be absolute since you will not be running
|
|
|
|
# configure from the same directory as the Android make. The normal
|
|
|
|
# cross-compiler options must also be set. Note that the -c, -o, -MD and
|
|
|
|
# similar flags must not be set.
|
|
|
|
#
|
|
|
|
# To see all the LIBS options, you'll need to do the "showcommands" trick on an
|
|
|
|
# executable that's already buildable and watch what flags Android uses to link
|
|
|
|
# it (dhcpcd is a good choice to watch). You'll also want to add -L options to
|
|
|
|
# LIBS that point to the out/.../obj/lib/ and out/.../obj/system/lib/
|
|
|
|
# directories so that additional libraries can be found and used by curl.
|
2009-09-16 00:35:49 +02:00
|
|
|
#
|
|
|
|
# The end result will be a configure command that looks something like this
|
2010-07-10 01:11:36 +02:00
|
|
|
# (the environment variable A is set to the Android root path which makes the
|
|
|
|
# command shorter):
|
2009-09-16 00:35:49 +02:00
|
|
|
#
|
|
|
|
# A=`realpath ../..` && \
|
|
|
|
# PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \
|
|
|
|
# ./configure --host=arm-linux CC=arm-eabi-gcc \
|
|
|
|
# CPPFLAGS="-I $A/system/core/include ..." \
|
2010-05-13 00:23:28 +02:00
|
|
|
# CFLAGS="-nostdlib -fno-exceptions -Wno-multichar ..." \
|
2010-08-11 06:36:27 +02:00
|
|
|
# LIBS="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\
|
|
|
|
# /interwork/libgcc.a ..."
|
2009-06-02 21:02:02 +02:00
|
|
|
#
|
2010-05-13 00:23:28 +02:00
|
|
|
# Finally, copy the file COPYING to NOTICE so that the curl license gets put
|
2010-08-11 06:36:27 +02:00
|
|
|
# into the right place (but see the note about this below).
|
2010-05-13 00:23:28 +02:00
|
|
|
#
|
2009-06-02 21:02:02 +02:00
|
|
|
# Dan Fandrich
|
2011-11-17 02:11:31 +01:00
|
|
|
# November 2011
|
2009-06-02 21:02:02 +02:00
|
|
|
|
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
|
|
|
|
common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Build the libcurl library
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
include $(LOCAL_PATH)/lib/Makefile.inc
|
2009-07-31 02:10:38 +02:00
|
|
|
CURL_HEADERS := \
|
|
|
|
curlbuild.h \
|
|
|
|
curl.h \
|
|
|
|
curlrules.h \
|
|
|
|
curlver.h \
|
|
|
|
easy.h \
|
|
|
|
mprintf.h \
|
|
|
|
multi.h \
|
|
|
|
stdcheaders.h \
|
2011-05-30 22:11:38 +02:00
|
|
|
typecheck-gcc.h
|
2009-07-31 02:10:38 +02:00
|
|
|
|
2009-06-02 21:02:02 +02:00
|
|
|
LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
|
|
|
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/
|
|
|
|
LOCAL_CFLAGS += $(common_CFLAGS)
|
|
|
|
|
2009-07-31 02:10:38 +02:00
|
|
|
LOCAL_COPY_HEADERS_TO := libcurl/curl
|
|
|
|
LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
|
|
|
|
|
2009-06-02 21:02:02 +02:00
|
|
|
LOCAL_MODULE:= libcurl
|
2011-06-20 21:01:38 +02:00
|
|
|
LOCAL_MODULE_TAGS := optional
|
2009-06-02 21:02:02 +02:00
|
|
|
|
2010-05-13 00:23:28 +02:00
|
|
|
# Copy the licence to a place where Android will find it.
|
|
|
|
# Actually, this doesn't quite work because the build system searches
|
|
|
|
# for NOTICE files before it gets to this point, so it will only be seen
|
|
|
|
# on subsequent builds.
|
|
|
|
ALL_PREBUILT += $(LOCAL_PATH)/NOTICE
|
|
|
|
$(LOCAL_PATH)/NOTICE: $(LOCAL_PATH)/COPYING | $(ACP)
|
|
|
|
$(copy-file-to-target)
|
|
|
|
|
2009-06-02 21:02:02 +02:00
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Build the curl binary
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
include $(LOCAL_PATH)/src/Makefile.inc
|
2010-08-02 12:24:54 +02:00
|
|
|
LOCAL_SRC_FILES := $(addprefix src/,$(CURL_CFILES))
|
2009-06-02 21:02:02 +02:00
|
|
|
|
|
|
|
LOCAL_MODULE := curl
|
2011-06-20 21:01:38 +02:00
|
|
|
LOCAL_MODULE_TAGS := optional
|
2009-06-02 21:02:02 +02:00
|
|
|
LOCAL_STATIC_LIBRARIES := libcurl
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
|
|
|
|
|
|
|
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
|
|
|
|
|
2010-08-11 06:36:27 +02:00
|
|
|
# This may also need to include $(CURLX_ONES) in order to correctly link
|
|
|
|
# if libcurl is changed to be built as a dynamic library
|
2009-06-02 21:02:02 +02:00
|
|
|
LOCAL_CFLAGS += $(common_CFLAGS)
|
|
|
|
|
|
|
|
include $(BUILD_EXECUTABLE)
|
|
|
|
|