Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@ language: c

sudo: false

env:
global:
- LCURL_CC_FLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs"
- LCURL_LD_FLAGS="-shared --coverage"

matrix:
include:
- compiler: ": Lua51-osx"
env: LUA="lua 5.1"
os: osx
- compiler: ": Lua51"
env: LUA="lua 5.1"
os: linux
- compiler: ": Lua52"
env: LUA="lua 5.2"
os: linux
- compiler: ": Lua53"
env: LUA="lua 5.3"
os: linux
- compiler: ": LuaJIT20"
env: LUA="luajit 2.0"
os: linux
- compiler: ": LuaJIT21"
env: LUA="luajit 2.1"
os: linux

cache:
directories:
Expand All @@ -26,19 +39,22 @@ branches:

before_install:
- export CC=gcc
- gcc --version
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PATH:~/Library/Python/2.7/bin/; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export LCURL_LD_FLAGS="-bundle -undefined dynamic_lookup -all_load --coverage"; fi
- pip install --user cpp-coveralls
- pip install --user hererocks
- hererocks here -r^ --$LUA
- export PATH=$PATH:$PWD/here/bin
- source here/bin/activate

install:
- luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
- luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="$LCURL_CC_FLAGS" LIBFLAG="$LCURL_LD_FLAGS"

before_script:
- luarocks show luacov-coveralls || luarocks install luacov-coveralls
- luarocks show lunitx || luarocks install lunitx
- luarocks show luafilesystem || luarocks install luafilesystem
- luarocks show dkjson || luarocks install dkjson --deps-mode=none
- luarocks show luacov-coveralls > /dev/null 2>&1 || luarocks install luacov-coveralls
- luarocks show lunitx > /dev/null 2>&1 || luarocks install lunitx
- luarocks show luafilesystem > /dev/null 2>&1 || luarocks install luafilesystem
- luarocks show dkjson > /dev/null 2>&1 || luarocks install dkjson --deps-mode=none

script:
- cd test
Expand Down
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ platform:

cache:
- c:\hererocks -> appveyor.yml
- c:\external -> appveyor.yml

install:
- set PATH=C:\Python27\Scripts;%LR_EXTERNAL%;%PATH%
Expand All @@ -35,9 +36,9 @@ install:
)
- if not exist c:\hererocks (
pip install hererocks &&
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest &&
call c:\hererocks\bin\activate
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest
)
- call c:\hererocks\bin\activate

before_build:
# external deps
Expand Down
9 changes: 9 additions & 0 deletions src/lceasy.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ enum {

#define LCURL_EASY_MAGIC 0xEA

#if LCURL_CC_SUPPORT_FORWARD_TYPEDEF
typedef struct lcurl_multi_tag lcurl_multi_t;
#else
struct lcurl_multi_tag;
#define lcurl_multi_t struct lcurl_multi_tag
#endif

typedef struct lcurl_easy_tag{
unsigned char magic;
Expand Down Expand Up @@ -67,4 +72,8 @@ void lcurl_easy_initlib(lua_State *L, int nup);

void lcurl__easy_assign_lua(lua_State *L, lcurl_easy_t *p, lua_State *value, int assign_multi);

#if !LCURL_CC_SUPPORT_FORWARD_TYPEDEF
#undef lcurl_multi_t
#endif

#endif
12 changes: 12 additions & 0 deletions src/lcmulti.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ typedef struct lcurl_multi_tag{
lcurl_callback_t sc;
}lcurl_multi_t;


#if LCURL_CC_SUPPORT_FORWARD_TYPEDEF
typedef struct lcurl_multi_tag lcurl_multi_t;
#else
struct lcurl_easy_tag;
#define lcurl_easy_t struct lcurl_easy_tag
#endif

int lcurl_multi_create(lua_State *L, int error_mode);

lcurl_multi_t *lcurl_getmulti_at(lua_State *L, int i);
Expand All @@ -35,4 +43,8 @@ void lcurl__multi_assign_lua(lua_State *L, lcurl_multi_t *p, lua_State *value, i

CURLMcode lcurl__multi_remove_handle(lua_State *L, lcurl_multi_t *p, lcurl_easy_t *e);

#if !LCURL_CC_SUPPORT_FORWARD_TYPEDEF
#undef lcurl_easy_t
#endif

#endif
12 changes: 12 additions & 0 deletions src/lcutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@

#include "lcurl.h"

#if defined(_MSC_VER) || defined(__cplusplus)
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 1
#elif defined(__STDC_VERSION__)
# if __STDC_VERSION__ >= 201112
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 1
# endif
#endif

#ifndef LCURL_CC_SUPPORT_FORWARD_TYPEDEF
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 0
#endif

#define LCURL_MAKE_VERSION(MIN, MAJ, PAT) ((MIN<<16) + (MAJ<<8) + PAT)
#define LCURL_CURL_VER_GE(MIN, MAJ, PAT) (LIBCURL_VERSION_NUM >= LCURL_MAKE_VERSION(MIN, MAJ, PAT))

Expand Down