summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-03-12 14:45:25 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-03-13 10:14:21 +0100
commit7c10488ebaa41165094f5cf632938d91fcec7deb (patch)
tree13167af7ab65f3d476eea37ae83d8e8b8ce88d61 /data
parent19832310fd591875b0ed4a98ec9f8ef1c4fa53e8 (diff)
Include ca-certificates on Android and iOS
Diffstat (limited to 'data')
-rw-r--r--data/ndk-build/GStreamer.java20
-rwxr-xr-xdata/ndk-build/gstreamer-1.0.mk23
-rw-r--r--data/ndk-build/gstreamer_android-1.0.c.in6
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.m5
4 files changed, 50 insertions, 4 deletions
diff --git a/data/ndk-build/GStreamer.java b/data/ndk-build/GStreamer.java
index 4fececc2..62802121 100644
--- a/data/ndk-build/GStreamer.java
+++ b/data/ndk-build/GStreamer.java
@@ -15,6 +15,7 @@ public class GStreamer {
public static void init(Context context) throws Exception {
nativeInit(context);
@INCLUDE_FONTS@ copyFonts(context);
+@INCLUDE_CA_CERTIFICATES@ copyCaCertificates(context);
}
@INCLUDE_FONTS@ private static void copyFonts(Context context) {
@@ -39,6 +40,23 @@ public class GStreamer {
@INCLUDE_FONTS@ }
@INCLUDE_FONTS@ }
+@INCLUDE_CA_CERTIFICATES@ private static void copyCaCertificates(Context context) {
+@INCLUDE_CA_CERTIFICATES@ AssetManager assetManager = context.getAssets();
+@INCLUDE_CA_CERTIFICATES@ File filesDir = context.getFilesDir();
+@INCLUDE_CA_CERTIFICATES@ File sslDir = new File (filesDir, "ssl");
+@INCLUDE_CA_CERTIFICATES@ File certsDir = new File (sslDir, "certs");
+@INCLUDE_CA_CERTIFICATES@ File certs = new File (certsDir, "ca-certificates.crt");
+@INCLUDE_CA_CERTIFICATES@
+@INCLUDE_CA_CERTIFICATES@ certsDir.mkdirs();
+@INCLUDE_CA_CERTIFICATES@
+@INCLUDE_CA_CERTIFICATES@ try {
+@INCLUDE_CA_CERTIFICATES@ /* Copy the certificates file */
+@INCLUDE_CA_CERTIFICATES@ copyFile (assetManager, "ssl/certs/ca-certificates.crt", certs);
+@INCLUDE_CA_CERTIFICATES@ } catch (IOException e) {
+@INCLUDE_CA_CERTIFICATES@ e.printStackTrace();
+@INCLUDE_CA_CERTIFICATES@ }
+@INCLUDE_CA_CERTIFICATES@ }
+
@INCLUDE_COPY_FILE@ private static void copyFile(AssetManager assetManager, String assetPath, File outFile) throws IOException {
@INCLUDE_COPY_FILE@ InputStream in;
@INCLUDE_COPY_FILE@ OutputStream out;
@@ -46,7 +64,7 @@ public class GStreamer {
@INCLUDE_COPY_FILE@ int read;
@INCLUDE_COPY_FILE@
@INCLUDE_COPY_FILE@ if (outFile.exists())
-@INCLUDE_COPY_FILE@ return;
+@INCLUDE_COPY_FILE@ outFile.delete();
@INCLUDE_COPY_FILE@
@INCLUDE_COPY_FILE@ in = assetManager.open(assetPath);
@INCLUDE_COPY_FILE@ out = new FileOutputStream (outFile);
diff --git a/data/ndk-build/gstreamer-1.0.mk b/data/ndk-build/gstreamer-1.0.mk
index eb86cb7c..a3a77d79 100755
--- a/data/ndk-build/gstreamer-1.0.mk
+++ b/data/ndk-build/gstreamer-1.0.mk
@@ -48,6 +48,10 @@ ifndef GSTREAMER_INCLUDE_FONTS
GSTREAMER_INCLUDE_FONTS := yes
endif
+ifndef GSTREAMER_INCLUDE_CA_CERTIFICATES
+GSTREAMER_INCLUDE_CA_CERTIFICATES := yes
+endif
+
# Include tools
include $(GSTREAMER_NDK_BUILD_PATH)/tools.mk
@@ -169,6 +173,9 @@ $(GSTREAMER_ANDROID_SO): copyjavasource_$(TARGET_ARCH_ABI)
ifeq ($(GSTREAMER_INCLUDE_FONTS),yes)
$(GSTREAMER_ANDROID_SO): copyfontsres_$(TARGET_ARCH_ABI)
endif
+ifeq ($(GSTREAMER_INCLUDE_CA_CERTIFICATES),yes)
+$(GSTREAMER_ANDROID_SO): copycacertificatesres_$(TARGET_ARCH_ABI)
+endif
delsharedlib_$(TARGET_ARCH_ABI): PRIV_B_DIR := $(GSTREAMER_BUILD_DIR)
delsharedlib_$(TARGET_ARCH_ABI):
@@ -212,11 +219,19 @@ buildsharedlibrary_$(TARGET_ARCH_ABI): $(GSTREAMER_ANDROID_O)
copyjavasource_$(TARGET_ARCH_ABI):
@$(call host-mkdir,src/org/freedesktop/gstreamer)
@$(call host-cp,$(GSTREAMER_NDK_BUILD_PATH)/GStreamer.java,src/org/freedesktop/gstreamer)
-ifeq ($(GSTREAMER_INCLUDE_FONTS), yes)
+ifeq ($(GSTREAMER_INCLUDE_FONTS),yes)
@$(HOST_SED) -i "s;@INCLUDE_FONTS@;;g" src/org/freedesktop/gstreamer/GStreamer.java
- @$(HOST_SED) -i "s;@INCLUDE_COPY_FILE@;;g" src/org/freedesktop/gstreamer/GStreamer.java
else
@$(HOST_SED) -i "s;@INCLUDE_FONTS@;//;g" src/org/freedesktop/gstreamer/GStreamer.java
+endif
+ifeq ($(GSTREAMER_INCLUDE_CA_CERTIFICATES),yes)
+ @$(HOST_SED) -i "s;@INCLUDE_CA_CERTIFICATES@;;g" src/org/freedesktop/gstreamer/GStreamer.java
+else
+ @$(HOST_SED) -i "s;@INCLUDE_CA_CERTIFICATES@;//;g" src/org/freedesktop/gstreamer/GStreamer.java
+endif
+ifneq (,$(findstring yes,$(GSTREAMER_INCLUDE_FONTS)$(GSTREAMER_INCLUDE_CA_CERTIFICATES)))
+ @$(HOST_SED) -i "s;@INCLUDE_COPY_FILE@;;g" src/org/freedesktop/gstreamer/GStreamer.java
+else
@$(HOST_SED) -i "s;@INCLUDE_COPY_FILE@;//;g" src/org/freedesktop/gstreamer/GStreamer.java
endif
@@ -225,3 +240,7 @@ copyfontsres_$(TARGET_ARCH_ABI):
@$(call host-mkdir,assets/fontconfig/fonts/truetype/)
@$(call host-cp,$(GSTREAMER_NDK_BUILD_PATH)/fontconfig/fonts.conf,assets/fontconfig)
@$(call host-cp,$(GSTREAMER_NDK_BUILD_PATH)/fontconfig/fonts/Ubuntu-R.ttf,assets/fontconfig/fonts/truetype)
+copycacertificatesres_$(TARGET_ARCH_ABI):
+ @$(call host-mkdir,assets/ssl/certs)
+ @$(call host-cp,$(GSTREAMER_ROOT)/etc/ssl/certs/ca-certificates.crt,assets/ssl/certs)
+
diff --git a/data/ndk-build/gstreamer_android-1.0.c.in b/data/ndk-build/gstreamer_android-1.0.c.in
index 9a2ee86b..db46e885 100644
--- a/data/ndk-build/gstreamer_android-1.0.c.in
+++ b/data/ndk-build/gstreamer_android-1.0.c.in
@@ -352,7 +352,7 @@ gst_android_init (JNIEnv * env, jclass klass, jobject context)
/* TODO: Should probably also set GST_PLUGIN_SCANNER and GST_PLUGIN_SYSTEM_PATH */
}
if (files_dir) {
- gchar *fontconfig;
+ gchar *fontconfig, *certs;
g_setenv ("HOME", files_dir, TRUE);
g_setenv ("XDG_DATA_DIRS", files_dir, TRUE);
@@ -363,6 +363,10 @@ gst_android_init (JNIEnv * env, jclass klass, jobject context)
fontconfig = g_build_filename (files_dir, "fontconfig", NULL);
g_setenv ("FONTCONFIG_PATH", fontconfig, TRUE);
g_free (fontconfig);
+
+ certs = g_build_filename (files_dir, "ssl", "certs", "ca-certificates.crt", NULL);
+ g_setenv ("CA_CERTIFICATES", certs, TRUE);
+ g_free (certs);
}
g_free (cache_dir);
g_free (files_dir);
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.m b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.m
index a97f6d54..8a299f23 100644
--- a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.m
+++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.m
@@ -21,6 +21,7 @@ gst_ios_init (void)
const gchar *tmp_dir = [tmp UTF8String];
const gchar *cache_dir = [cache UTF8String];
const gchar *docs_dir = [docs UTF8String];
+ gchar *ca_certificates;
g_setenv ("TMP", tmp_dir, TRUE);
g_setenv ("TEMP", tmp_dir, TRUE);
@@ -34,6 +35,10 @@ gst_ios_init (void)
g_setenv ("XDG_CONFIG_HOME", cache_dir, TRUE);
g_setenv ("XDG_DATA_HOME", resources_dir, TRUE);
g_setenv ("FONTCONFIG_PATH", resources_dir, TRUE);
+
+ ca_certificates = g_build_filename (resources_dir, "ssl", "certs", "ca-certifcates.crt", NULL);
+ g_setenv ("CA_CERTIFICATES", ca_certificates, TRUE);
+ g_free (ca_cacertificates);
gst_init (NULL, NULL);