Skip to content

Commit

Permalink
v7.72.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vvb2060 committed Oct 6, 2020
0 parents commit c009331
Show file tree
Hide file tree
Showing 26 changed files with 1,700 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "curl/src/main/native/curl"]
path = curl/src/main/native/curl
url = https://github.com/curl/curl.git
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# curl Android

curl static library prefab for android

## Integration

Gradle:

```gradle
implementation 'io.github.vvb2060.ndk:curl:7.72.0'
```

This library is [Prefab](https://google.github.io/prefab/), so you will need to enable it in your project (Android Gradle Plugin 4.1+):

```gradle
android {
...
buildFeatures {
...
prefab true
}
}
```

## Usage

### ndk-build

you can use `curl_static` in your `Android.mk`.
For example, if your application defines `libapp.so` and it uses `curl_static`, your `Android.mk` file should include the following:

```makefile
include $(CLEAR_VARS)
LOCAL_MODULE := app
LOCAL_SRC_FILES := app.cpp
LOCAL_STATIC_LIBRARIES := curl_static
include $(BUILD_SHARED_LIBRARY)

# If you don't need your project to build with NDKs older than r21, you can omit
# this block.
ifneq ($(call ndk-major-at-least,21),true)
$(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
endif

$(call import-module,prefab/curl)
```

### CMake

you can use `curl_static` in your `CMakeLists.txt`.
For example, if your application defines `libapp.so` and it uses `curl_static`, your `CMakeLists.txt` file should include the following:

```cmake
add_library(app SHARED app.cpp)
# Add these two lines.
find_package(curl REQUIRED CONFIG)
target_link_libraries(app curl::curl_static)
```
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0-alpha13"
}
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions curl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions curl/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'com.android.library'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName '7.72.0'
ndkVersion '21.3.6528147'
externalNativeBuild {
ndkBuild {
arguments "-j${Runtime.runtime.availableProcessors()}"
}
}
}

buildTypes {
release {
minifyEnabled true
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
buildConfig false
prefabPublishing true
}

externalNativeBuild {
ndkBuild.path 'src/main/native/Android.mk'
}

prefab {
curl_static {
headers "src/main/native/curl/include"
}
}
}
8 changes: 8 additions & 0 deletions curl/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.vvb2060.ndk.curl">

<uses-permission android:name="android.permission.INTERNET" />

</manifest>
12 changes: 12 additions & 0 deletions curl/src/main/native/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
include $(LOCAL_PATH)/curl/lib/Makefile.inc
LOCAL_MODULE := curl_static
LOCAL_SRC_FILES := $(addprefix curl/lib/,$(CSOURCES))
LOCAL_C_INCLUDES := $(LOCAL_PATH)/curl/include $(LOCAL_PATH)/curl/lib $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/curl/include
LOCAL_CFLAGS := -DHAVE_CONFIG_H -DBUILDING_LIBCURL
# https://gist.github.com/vvb2060/56d5b8fda2553f36938b2b72b1390114
STATIC_LIBRARY_STRIP := true
include $(BUILD_STATIC_LIBRARY)
4 changes: 4 additions & 0 deletions curl/src/main/native/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
APP_CFLAGS := -Wall -Werror -fvisibility=hidden
APP_CFLAGS += -Wno-builtin-macro-redefined -D__FILE__=__FILE_NAME__
APP_CONLYFLAGS := -std=c99
APP_STL := c++_static
1 change: 1 addition & 0 deletions curl/src/main/native/curl
Submodule curl added at 9d954e
Loading

0 comments on commit c009331

Please sign in to comment.