diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org> | 2022-10-05 14:21:46 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org> | 2022-10-05 14:21:46 +0800 |
commit | 3d95da3da33d9b3c8c40e8250347301efa76a539 (patch) | |
tree | 324d1b75c1465634ce22e3f3342205c216174cca | |
parent | 2acbbcd9b7d9aa41f50ee74830e8d911a62ba380 (diff) |
Drop support for WASM for now
-rw-r--r-- | Makefile.am | 7 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | midtrans.c | 12 |
3 files changed, 2 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am index 5ed6aa5..573ef99 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,12 +1,7 @@ lib_LTLIBRARIES = libmidtrans.la libmidtrans_la_SOURCES = midtrans.c -libmidtrans_la_CPPFLAGS = $(JSON_CFLAGS) +libmidtrans_la_CPPFLAGS = $(DEPS_CFLAGS) if IOS libmidtrans_la_LDFLAGS = -static endif -if WASM -libmidtrans_la_LDFLAGS = -static -else -libmidtrans_la_CPPFLAGS += $(CURL_CFLAGS) -endif include_HEADERS = midtrans.h diff --git a/configure.ac b/configure.ac index 9855fdf..cf39de2 100644 --- a/configure.ac +++ b/configure.ac @@ -3,19 +3,12 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC AM_PROG_AR LT_INIT -PKG_CHECK_MODULES([JSON], [json-c]) +PKG_CHECK_MODULES([DEPS], [libcurl json-c]) AC_CANONICAL_HOST case $host in *arm*apple-darwin1* ) ios=true;; *) ios=false;; esac AM_CONDITIONAL([IOS], [test "x$ios" = xtrue]) -case $host_cpu in - *wasm* ) wasm=true;; - *) wasm=false;; -esac -AM_CONDITIONAL([WASM], [test "x$wasm" = xtrue]) -AS_IF([test "x$wasm" != xtrue], - [PKG_CHECK_MODULES([CURL], [libcurl])]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT @@ -1,10 +1,6 @@ #include <stdio.h> #include <string.h> -#ifdef __EMSCRIPTEN__ -#include <emscripten/fetch.h> -#else #include <curl/curl.h> -#endif #include <json.h> #include "midtrans.h" @@ -12,9 +8,7 @@ static _Bool sandbox; static char *base_url; -#ifndef __EMSCRIPTEN__ static CURL *curl; -#endif void midtrans_init(_Bool production, const char *api_key, const char *cainfo) { @@ -24,7 +18,6 @@ void midtrans_init(_Bool production, const char *api_key, const char *cainfo) base_url = malloc(strlen(url_tmpl) - strlen ("%s") + sandbox * strlen(infix) + 1); sprintf(base_url, url_tmpl, production ? "" : infix); -#ifndef __EMSCRIPTEN__ curl_global_init(CURL_GLOBAL_SSL); curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); @@ -37,7 +30,6 @@ void midtrans_init(_Bool production, const char *api_key, const char *cainfo) list = curl_slist_append(list, auth); if (cainfo) curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); -#endif } void midtrans_status(const char *order_id) @@ -46,17 +38,13 @@ void midtrans_status(const char *order_id) char url[strlen(tmpl) - strlen("%s") * 2 + strlen(base_url) + (sandbox ? strlen(ORDER_ID) : strlen(order_id)) + 1]; sprintf(url, tmpl, base_url, sandbox ? ORDER_ID : order_id); -#ifndef __EMSCRIPTEN__ curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_perform(curl); -#endif } void midtrans_cleanup() { free(base_url); -#ifndef __EMSCRIPTEN__ curl_easy_cleanup(curl); curl_global_cleanup(); -#endif } |