aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lua/patches/020-shared_liblua.patch
blob: d948841b8a67cd7fb7c4600b2dfa5c1a6215bcbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Index: lua-5.1.4/Makefile
===================================================================
--- lua-5.1.4.orig/Makefile	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/Makefile	2008-08-24 16:48:42.000000000 +0200
@@ -42,8 +42,8 @@
 
 # What to install.
 TO_BIN= lua luac
-TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp lnum_config.h
+TO_LIB= liblua.a liblua.so.$R
 TO_MAN= lua.1 luac.1
 
 # Lua version and release.
@@ -63,6 +63,7 @@
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	ln -s liblua.so.$R $(INSTALL_LIB)/liblua.so
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
 
 ranlib:
Index: lua-5.1.4/src/ldo.h
===================================================================
--- lua-5.1.4.orig/src/ldo.h	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/src/ldo.h	2008-08-24 16:48:42.000000000 +0200
@@ -46,7 +46,7 @@
 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
-LUAI_FUNC void luaD_growstack (lua_State *L, int n);
+LUA_API void luaD_growstack (lua_State *L, int n);
 
 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
Index: lua-5.1.4/src/lfunc.h
===================================================================
--- lua-5.1.4.orig/src/lfunc.h	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/src/lfunc.h	2008-08-24 16:48:42.000000000 +0200
@@ -18,7 +18,7 @@
                          cast(int, sizeof(TValue *)*((n)-1)))
 
 
-LUAI_FUNC Proto *luaF_newproto (lua_State *L);
+LUA_API Proto *luaF_newproto (lua_State *L);
 LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
 LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
 LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
Index: lua-5.1.4/src/lmem.h
===================================================================
--- lua-5.1.4.orig/src/lmem.h	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/src/lmem.h	2008-08-24 16:48:42.000000000 +0200
@@ -38,9 +38,9 @@
    ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
 
 
-LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
+LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
                                                           size_t size);
-LUAI_FUNC void *luaM_toobig (lua_State *L);
+LUA_API void *luaM_toobig (lua_State *L);
 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
                                size_t size_elem, int limit,
                                const char *errormsg);
Index: lua-5.1.4/src/lstring.h
===================================================================
--- lua-5.1.4.orig/src/lstring.h	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/src/lstring.h	2008-08-24 16:48:42.000000000 +0200
@@ -25,7 +25,7 @@
 
 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
 
 
 #endif
Index: lua-5.1.4/src/lundump.h
===================================================================
--- lua-5.1.4.orig/src/lundump.h	2008-08-24 16:46:37.000000000 +0200
+++ lua-5.1.4/src/lundump.h	2008-08-24 16:48:42.000000000 +0200
@@ -17,7 +17,7 @@
 LUAI_FUNC void luaU_header (char* h);
 
 /* dump one chunk; from ldump.c */
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
 
 #ifdef luac_c
 /* print one chunk; from print.c */
Index: lua-5.1.4/src/Makefile
===================================================================
--- lua-5.1.4.orig/src/Makefile	2008-08-24 16:48:20.000000000 +0200
+++ lua-5.1.4/src/Makefile	2008-08-24 16:48:42.000000000 +0200
@@ -23,6 +23,7 @@
 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
 
 LUA_A=	liblua.a
+LUA_SO= liblua.so
 CORE_O=	lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
 	lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
 	lundump.o lvm.o lzio.o lnum.o
@@ -33,11 +34,12 @@
 LUA_O=	lua.o
 
 LUAC_T=	luac
-LUAC_O=	luac.o print.o
+LUAC_O=	luac.o print.o lopcodes.o
 
 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
 ALL_A= $(LUA_A)
+ALL_SO= $(LUA_SO)
 
 default: $(PLAT)
 
@@ -47,14 +49,23 @@
 
 a:	$(ALL_A)
 
+so:	$(ALL_SO)
+
 $(LUA_A): $(CORE_O) $(LIB_O)
 	$(AR) $@ $?
 	$(RANLIB) $@
 
-$(LUA_T): $(LUA_O) $(LUA_A)
-	$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $? -nostdlib -lgcc
+	ln -fs $@.$(PKG_VERSION) $@
+
+$(LUA_T): $(LUA_O) $(LUA_SO)
+	$(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS)
+
+$(LUAC_T): $(LUAC_O) $(LUA_SO)
+	$(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS)
 
-$(LUAC_T): $(LUAC_O) $(LUA_A)
+$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
 
 clean:
@@ -96,7 +107,7 @@
 	$(MAKE) all MYCFLAGS=
 
 linux:
-	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
+	$(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
 
 macosx:
 	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
__DOXYGEN__) #define L3GD20_USE_SPI TRUE #endif /** * @brief L3GD20 I2C interface switch. * @details If set to @p TRUE the support for I2C is included. * @note The default is @p FALSE. */ #if !defined(L3GD20_USE_I2C) || defined(__DOXYGEN__) #define L3GD20_USE_I2C FALSE #endif /** * @brief L3GD20 shared SPI switch. * @details If set to @p TRUE the device acquires SPI bus ownership * on each transaction. * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION */ #if !defined(L3GD20_SHARED_SPI) || defined(__DOXYGEN__) #define L3GD20_SHARED_SPI FALSE #endif /** * @brief Number of acquisitions for bias removal * @details This is the number of acquisitions performed to compute the * bias. A repetition is required in order to remove noise. */ #if !defined(L3GD20_BIAS_ACQ_TIMES) || defined(__DOXYGEN__) #define L3GD20_BIAS_ACQ_TIMES 50 #endif /** * @brief Settling time for bias removal * @details This is the time between each bias acquisition. */ #if !defined(L3GD20_BIAS_SETTLING_uS) || defined(__DOXYGEN__) #define L3GD20_BIAS_SETTLING_uS 5000 #endif /** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if !(L3GD20_USE_SPI ^ L3GD20_USE_I2C) #error "L3GD20_USE_SPI and L3GD20_USE_I2C cannot be both true or both false" #endif #if L3GD20_USE_SPI && !HAL_USE_SPI #error "L3GD20_USE_SPI requires HAL_USE_SPI" #endif #if L3GD20_USE_I2C && !HAL_USE_I2C #error "L3GD20_USE_I2C requires HAL_USE_I2C" #endif #if L3GD20_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION #error "L3GD20_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION" #endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /** * @name L3GD20 data structures and types * @{ */ /** * @brief L3GD20 full scale */ typedef enum { L3GD20_FS_250DPS = 0x00, /**< Full scale 250 degree per second. */ L3GD20_FS_500DPS = 0x10, /**< Full scale 500 degree per second. */ L3GD20_FS_2000DPS = 0x20 /**< Full scale 2000 degree per second. */ }l3gd20_fs_t; /** * @brief L3GD20 output data rate and bandwidth */ typedef enum { L3GD20_ODR_95HZ_FC_12_5 = 0x00, /**< ODR 95 Hz, BW 12.5 Hz. */ L3GD20_ODR_95HZ_FC_25 = 0x10, /**< ODR 95 Hz, BW 25Hz. */ L3GD20_ODR_190HZ_FC_12_5 = 0x40, /**< ODR 190 Hz, BW 12.5 Hz. */ L3GD20_ODR_190HZ_FC_25 = 0x50, /**< ODR 190 Hz, BW 25 Hz. */ L3GD20_ODR_190HZ_FC_50 = 0x60, /**< ODR 190 Hz, BW 50 Hz. */ L3GD20_ODR_190HZ_FC_70 = 0x70, /**< ODR 190 Hz, BW 70 Hz. */ L3GD20_ODR_380HZ_FC_20 = 0x80, /**< ODR 380 Hz, BW 20 Hz. */ L3GD20_ODR_380HZ_FC_25 = 0x90, /**< ODR 380 Hz, BW 25 Hz. */ L3GD20_ODR_380HZ_FC_50 = 0xA0, /**< ODR 380 Hz, BW 50 Hz. */ L3GD20_ODR_380HZ_FC_100 = 0xB0, /**< ODR 380 Hz, BW 100 Hz. */ L3GD20_ODR_760HZ_FC_30 = 0xC0, /**< ODR 760 Hz, BW 30 Hz. */ L3GD20_ODR_760HZ_FC_35 = 0xD0, /**< ODR 760 Hz, BW 35 Hz. */ L3GD20_ODR_760HZ_FC_50 = 0xE0, /**< ODR 760 Hz, BW 50 Hz. */ L3GD20_ODR_760HZ_FC_100 = 0xF0 /**< ODR 760 Hz, BW 100 Hz. */ }l3gd20_odr_t; /** * @brief L3GD20 axes enabling */ typedef enum { L3GD20_AE_DISABLED = 0x00, /**< All axes disabled. */ L3GD20_AE_X = 0x01, /**< Only X-axis enabled. */ L3GD20_AE_Y = 0x02, /**< Only Y-axis enabled. */ L3GD20_AE_XY = 0x03, /**< X and Y axes enabled. */ L3GD20_AE_Z = 0x04, /**< Only Z-axis enabled. */ L3GD20_AE_XZ = 0x05, /**< X and Z axes enabled. */ L3GD20_AE_YZ = 0x06, /**< Y and Z axes enabled. */ L3GD20_AE_XYZ = 0x07 /**< All axes enabled. */ }l3gd20_ae_t; /** * @brief L3GD20 block data update */ typedef enum { L3GD20_BDU_CONTINUOUS = 0x00, /**< Block data continuously updated. */ L3GD20_BDU_BLOCKED = 0x80 /**< Block data updated after reading. */ }l3gd20_bdu_t; /** * @brief L3GD20 endianness */ typedef enum { L3GD20_END_LITTLE = 0x00, /**< Little endian. */ L3GD20_END_BIG = 0x40 /**< Big endian. */ }l3gd20_end_t; /** * @brief Driver state machine possible states. */ typedef enum { L3GD20_UNINIT = 0, /**< Not initialized. */ L3GD20_STOP = 1, /**< Stopped. */ L3GD20_READY = 2, /**< Ready. */ } l3gd20_state_t; /** * @brief L3GD20 configuration structure. */ typedef struct { #if (L3GD20_USE_SPI) || defined(__DOXYGEN__) /** * @brief SPI driver associated to this L3GD20. */ SPIDriver *spip; /** * @brief SPI configuration associated to this L3GD20. */ const SPIConfig *spicfg; #endif /* L3GD20_USE_SPI */ #if (L3GD20_USE_I2C) || defined(__DOXYGEN__) /** * @brief I2C driver associated to this L3GD20. */ I2CDriver *i2cp; /** * @brief I2C configuration associated to this L3GD20. */ const I2CConfig *i2ccfg; #endif /* L3GD20_USE_I2C */ /** * @brief L3GD20 full scale value. */ l3gd20_fs_t fullscale; /** * @brief L3GD20 output data rate selection. */ l3gd20_odr_t outputdatarate; /** * @brief L3GD20 axes enabling. */ l3gd20_ae_t axesenabling; /** * @brief L3GD20 block data update. */ l3gd20_bdu_t blockdataupdate; /** * @brief L3GD20 endianness. */ l3gd20_end_t endianness; } L3GD20Config; /** * @brief Structure representing a L3GD20 driver. */ typedef struct L3GD20Driver L3GD20Driver; /** * @brief @p L3GD20 specific methods. */ #define _l3gd20_methods \ _base_gyroscope_methods \ /* Retrieve the temperature of L3GD20 chip.*/ \ msg_t (*get_temperature)(void *instance, float* temperature); /** * @extends BaseGyroscopeVMT * * @brief @p L3GD20 virtual methods table. */ struct L3GD20VMT { _l3gd20_methods }; /** * @brief @p L3GD20Driver specific data. */ #define _l3gd20_data \ _base_gyroscope_data \ /* Driver state.*/ \ l3gd20_state_t state; \ /* Current configuration data.*/ \ const L3GD20Config *config; \ /* Current sensitivity.*/ \ float sensitivity[L3GD20_NUMBER_OF_AXES]; \ /* Bias data.*/ \ int32_t bias[L3GD20_NUMBER_OF_AXES]; /** * @extends BaseGyroscope * * @brief L3GD20 3-axis gyroscope class. * @details This class extends @p BaseGyroscope by adding physical * driver implementation. */ struct L3GD20Driver { /** @brief BaseSensor Virtual Methods Table. */ const struct BaseSensorVMT *vmt_basesensor; /** @brief BaseGyroscope Virtual Methods Table. */ const struct BaseGyroscopeVMT *vmt_basegyroscope; /** @brief L3GD20 Virtual Methods Table. */ const struct L3GD20VMT *vmt_l3gd20; _l3gd20_data }; /** @} */ /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /** * @brief Get current MEMS temperature. * @detail This information is very useful especially for high accuracy IMU * * @param[in] ip pointer to a @p BaseGyroscope class. * @param[out] temp the MEMS temperature as single precision floating. * * @return The operation status. * @retval MSG_OK if the function succeeded. * @retval MSG_RESET if one or more errors occurred. * @api */ #define gyroscopeGetTemp(ip, tpp) \ (ip)->vmt_l3gd20->get_temperature(ip, tpp) /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #ifdef __cplusplus extern "C" { #endif void l3gd20ObjectInit(L3GD20Driver *devp); void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config); void l3gd20Stop(L3GD20Driver *devp); #ifdef __cplusplus } #endif #endif /* _L3GD20_H_ */ /** @} */