Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 113 lines (95 sloc) 4.474 kb
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
1 # Google Android makefile for curl and libcurl
e3049e9 @dfandrich Provide instructions on creating curl_config.h
dfandrich authored
2 #
b6a141e @dfandrich Updated build docs w.r.t. Android and binary sizes
dfandrich authored
3 # This file can be used when building curl using the full Android source
4 # release or the NDK. Most users do not want or need to do this; please
5 # instead read the Android section in docs/INSTALL for alternate
6 # methods.
6e1f867 @gknauf Added hint to read docs/INSTALL too.
gknauf authored
7 #
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
8 # Place the curl source (including this makefile) into external/curl/ in the
9 # Android source tree. Then build them with 'make curl' or just 'make libcurl'
591c29a @dfandrich curl has been built on many Android versions
dfandrich authored
10 # from the Android root. Tested with Android versions 1.5, 2.1-2.3
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
11 #
18b3833 @gknauf renamed generated config.h to curl_config.h in order to avoid clashes…
gknauf authored
12 # Note: you must first create a curl_config.h file by running configure in the
e3049e9 @dfandrich Provide instructions on creating curl_config.h
dfandrich authored
13 # Android environment. The only way I've found to do this is tricky. Perform a
14 # normal Android build with libcurl in the source tree, providing the target
15 # "showcommands" to make. The build will eventually fail (because curl_config.h
16 # doesn't exist yet), but the compiler commands used to build curl will be
17 # shown. Now, from the external/curl/ directory, run curl's normal configure
18 # command with flags that match what Android itself uses. This will mean
19 # putting the compiler directory into the PATH, putting the -I, -isystem and
1dbb9a0 @dfandrich Improved the Android build instructions
dfandrich authored
20 # -D options into CPPFLAGS, putting the -W, -m, -f, -O and -nostdlib options
21 # into CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the
22 # path to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o.
23 # Remember that the paths must be absolute since you will not be running
24 # configure from the same directory as the Android make. The normal
25 # cross-compiler options must also be set. Note that the -c, -o, -MD and
26 # similar flags must not be set.
27 #
28 # To see all the LIBS options, you'll need to do the "showcommands" trick on an
29 # executable that's already buildable and watch what flags Android uses to link
30 # it (dhcpcd is a good choice to watch). You'll also want to add -L options to
31 # LIBS that point to the out/.../obj/lib/ and out/.../obj/system/lib/
32 # directories so that additional libraries can be found and used by curl.
e3049e9 @dfandrich Provide instructions on creating curl_config.h
dfandrich authored
33 #
34 # The end result will be a configure command that looks something like this
1dbb9a0 @dfandrich Improved the Android build instructions
dfandrich authored
35 # (the environment variable A is set to the Android root path which makes the
36 # command shorter):
e3049e9 @dfandrich Provide instructions on creating curl_config.h
dfandrich authored
37 #
38 # A=`realpath ../..` && \
39 # PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \
40 # ./configure --host=arm-linux CC=arm-eabi-gcc \
41 # CPPFLAGS="-I $A/system/core/include ..." \
147609c @dfandrich Copy the license file so it's seen by the Android build system
dfandrich authored
42 # CFLAGS="-nostdlib -fno-exceptions -Wno-multichar ..." \
6cf90c6 @dfandrich Fixed typo in Android configure command
dfandrich authored
43 # LIBS="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\
44 # /interwork/libgcc.a ..."
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
45 #
147609c @dfandrich Copy the license file so it's seen by the Android build system
dfandrich authored
46 # Finally, copy the file COPYING to NOTICE so that the curl license gets put
6cf90c6 @dfandrich Fixed typo in Android configure command
dfandrich authored
47 # into the right place (but see the note about this below).
147609c @dfandrich Copy the license file so it's seen by the Android build system
dfandrich authored
48 #
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
49 # Dan Fandrich
591c29a @dfandrich curl has been built on many Android versions
dfandrich authored
50 # November 2011
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
51
52 LOCAL_PATH:= $(call my-dir)
53
54 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
55
56 #########################
57 # Build the libcurl library
58
59 include $(CLEAR_VARS)
60 include $(LOCAL_PATH)/lib/Makefile.inc
e8e84cf @dfandrich Copy the libcurl header files into the right location for Android.
dfandrich authored
61 CURL_HEADERS := \
62 curlbuild.h \
63 curl.h \
64 curlrules.h \
65 curlver.h \
66 easy.h \
67 mprintf.h \
68 multi.h \
69 stdcheaders.h \
9460896 @dfandrich Removed types.h from Android makefile
dfandrich authored
70 typecheck-gcc.h
e8e84cf @dfandrich Copy the libcurl header files into the right location for Android.
dfandrich authored
71
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
72 LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
73 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/
74 LOCAL_CFLAGS += $(common_CFLAGS)
75
e8e84cf @dfandrich Copy the libcurl header files into the right location for Android.
dfandrich authored
76 LOCAL_COPY_HEADERS_TO := libcurl/curl
77 LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
78
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
79 LOCAL_MODULE:= libcurl
4cbc6fc @dfandrich Added LOCAL_MODULE_TAGS to support Android gingerbread
dfandrich authored
80 LOCAL_MODULE_TAGS := optional
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
81
147609c @dfandrich Copy the license file so it's seen by the Android build system
dfandrich authored
82 # Copy the licence to a place where Android will find it.
83 # Actually, this doesn't quite work because the build system searches
84 # for NOTICE files before it gets to this point, so it will only be seen
85 # on subsequent builds.
86 ALL_PREBUILT += $(LOCAL_PATH)/NOTICE
87 $(LOCAL_PATH)/NOTICE: $(LOCAL_PATH)/COPYING | $(ACP)
88 $(copy-file-to-target)
89
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
90 include $(BUILD_STATIC_LIBRARY)
91
92
93 #########################
94 # Build the curl binary
95
96 include $(CLEAR_VARS)
97 include $(LOCAL_PATH)/src/Makefile.inc
f97a7eb @gknauf Rename CURL_SOURCES macro; revert previous rename of curl_SOURCES macro.
gknauf authored
98 LOCAL_SRC_FILES := $(addprefix src/,$(CURL_CFILES))
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
99
100 LOCAL_MODULE := curl
4cbc6fc @dfandrich Added LOCAL_MODULE_TAGS to support Android gingerbread
dfandrich authored
101 LOCAL_MODULE_TAGS := optional
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
102 LOCAL_STATIC_LIBRARIES := libcurl
103 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
104
105 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
106
6cf90c6 @dfandrich Fixed typo in Android configure command
dfandrich authored
107 # This may also need to include $(CURLX_ONES) in order to correctly link
108 # if libcurl is changed to be built as a dynamic library
e127092 @dfandrich Created a basic Android make file for curl and libcurl. A config.h
dfandrich authored
109 LOCAL_CFLAGS += $(common_CFLAGS)
110
111 include $(BUILD_EXECUTABLE)
112
Something went wrong with that request. Please try again.