File tree Expand file tree Collapse file tree 6 files changed +99
-13
lines changed
Expand file tree Collapse file tree 6 files changed +99
-13
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ build-app/
55bin /
66* .o
77* .so *
8+ * .dll
89* .a
910* .la
1011pkgconfig
Original file line number Diff line number Diff line change 1+ lua-download :
2+ @echo " Descarga de lua"
3+ bash ./scripts/lua.bash download
14
25lua-linux :
3- @echo " Descarga compilación o crosscompilación de Lua"
4- bash ./scripts/lua.bash download
6+ @echo " Compilación o crosscompilación de Lua"
57 bash ./scripts/lua.bash build-linux
68 bash ./scripts/lua.bash install-linux
79
8- libserialport-linux :
9- @echo " Descargar y crear librería libserialport"
10+ lua-windows :
11+ @echo " Compilación o crosscompilación de Lua"
12+ bash ./scripts/lua.bash build-windows
13+
14+ libserialport-download :
15+ @echo " Descargar la librería libserialpor"
1016 bash ./scripts/libserialport.bash download
17+
18+ libserialport-linux :
19+ @echo " Compilar la librería para Linux"
20+ # bash ./scripts/libserialport.bash dependencies-linux
1121 bash ./scripts/libserialport.bash build-linux
1222
23+ libserialport-windows :
24+ @echo " Cross compilar la librería para Windows"
25+ # bash ./scripts/libserialport.bash dependencies-windows
26+ bash ./scripts/libserialport.bash build-windows
Original file line number Diff line number Diff line change @@ -29,7 +29,14 @@ make test
2929
3030### Plataforma Windows
3131
32- TODO: Requiere crear los scripts
32+ TODO: Scripts aún en prueba
33+
34+ ```
35+ make libserialport-windows lua-windows
36+ cd src/
37+ make all AR=w64
38+
39+ ```
3340
3441
3542### Importación de librería
Original file line number Diff line number Diff line change @@ -5,13 +5,21 @@ SCRIPT_PATH=$(pwd)
55BUILDER_PATH=$SCRIPT_PATH /build-app
66DIR_APP=$BUILDER_PATH /$APP
77
8- dependencies () {
8+ dependencies-linux () {
99 sudo apt update
1010 sudo apt install \
1111 libtool \
1212 -y
1313}
1414
15+ dependencies-windows () {
16+ sudo apt update
17+ sudo apt install \
18+ libtool \
19+ mingw-w64 \
20+ -y
21+ }
22+
1523download () {
1624 mkdir -p $BUILDER_PATH
1725 cd $BUILDER_PATH
@@ -21,7 +29,7 @@ download() {
2129
2230build-linux () {
2331 cd $DIR_APP
24- dependencies
32+ make clean
2533 ./autogen.sh
2634 # ./configure
2735 ./configure --prefix=$( pwd) /../../src/
@@ -31,6 +39,20 @@ build-linux() {
3139 ls -ltrh .libs/
3240}
3341
42+ build-windows () {
43+ cd $DIR_APP
44+ make clean
45+ ./autogen.sh
46+ # Configuración para windows 64 bits
47+ ./configure --prefix=$( pwd) /../../src/ --host=x86_64-w64-mingw32
48+ # Configuración para windows de 32 bits
49+ # ./configure --prefix=$(pwd)/../../src/ --host=i686-w64-mingw32
50+ make
51+ make install
52+ echo " ls -ltrh .libs/"
53+ ls -ltrh .libs/
54+ }
55+
3456if [[ -v 1 ]]; then
3557 $1
3658fi
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ download() {
2323 curl -L -R -O $DOWNLOAD_APP
2424 tar xzf $APP -$VERSION .tar.gz
2525 rm -f $APP -$VERSION .tar.gz
26- ln -sr $APP -$VERSION $APP
26+ echo " Crear enlace simbólico de lua al src de libserial."
27+ rm -rf ../src/lib/lua
28+ ln -sr $APP -$VERSION /src/ ../src/lib/lua
2729}
2830
2931build-linux () {
@@ -34,11 +36,26 @@ build-linux() {
3436 dependencies
3537 make linux
3638 elif [[ $VERSION == " 5.4.6" ]]; then
39+ make clean
3740 make all test PLATFORM=$PLATFORM
3841 fi
3942 cp src/lua ../../src/lua
4043}
4144
45+ build-windows () {
46+ cd $DIR_APP
47+ # rm -f ../../src/lib/lua
48+ # ln -sr src ../../src/lib/lua
49+ if [[ $VERSION == " 5.2.4" ]]; then
50+ dependencies
51+ make linux
52+ elif [[ $VERSION == " 5.4.6" ]]; then
53+ make clean
54+ make CC=x86_64-w64-mingw32-gcc mingw
55+ fi
56+ # cp src/lua ../../src/lua
57+ }
58+
4259install-linux () {
4360 mkdir -p $BIN
4461 cd $DIR_APP /src
Original file line number Diff line number Diff line change 1- CC = gcc -v
21CFLAGS = -O2 -fPIC
2+ INCLUDES = -Iinclude -Ilib/lua
33LDFLAGS = -shared
44LIBSERIALPORT_DIR =.
5- INCLUDES = -Iinclude
5+
6+ ifeq ($(AR ) ,w64)
7+ CC = x86_64-w64-mingw32-gcc -v
8+ LIBS = -L$(LIBSERIALPORT_DIR ) /lib -L$(LIBSERIALPORT_DIR ) /lib/lua -lserialport -llua
9+ OBJ =libserial.dll
10+ else ifeq ($(AR),w32)
11+ CC = i686-w64-mingw32-gcc -v
12+ LIBS = -L$(LIBSERIALPORT_DIR ) /lib -L$(LIBSERIALPORT_DIR ) /lib/lua -lserialport -llua
13+ OBJ =libserial.dll
14+ else
15+ CC = gcc -v
616LIBS = -L$(LIBSERIALPORT_DIR ) /lib -lserialport
17+ OBJ =libserial.so
18+ endif
719
820f =./luatest/test.lua
921
10- all : libserial.so
22+ h : help
23+
24+ all : $(OBJ )
25+
26+ libserial.dll : libserial.o
27+ @echo " ##> ENLAZAR"
28+ $(CC ) $(LDFLAGS ) -o $@ $^ $(LIBS ) -Wl,-rpath,$(LIBSERIALPORT_DIR ) /lib
1129
1230libserial.so : libserial.o
31+ @echo " ##> ENLAZAR"
1332 $(CC ) $(LDFLAGS ) -o $@ $^ $(LIBS ) -Wl,-rpath,$(LIBSERIALPORT_DIR ) /lib
1433
1534libserial.o : libserial.c
35+ @echo " ##> COMPILAR"
1636 $(CC ) $(CFLAGS ) $(INCLUDES ) -c $< -o $@
1737
1838test :
1939 ./lua $f
2040
21- dist-linux :
41+ dist-linux : $( OBJ )
2242 rm -f libserial.zip
2343 zip -r libserial.zip ./lib/libserialport.so.0 ./libserial.so
2444
2545clean :
26- rm -f * .o libserial.so * .zip
46+ rm -f * .o libserial.dll libserial.so * .zip
47+
48+ help :
49+ @echo " make all -> Construye la librería para Linux"
50+ @echo " make all AR=w64 -> Construye la librería para Windows"
51+ @echo " make clean -> Borra los objetos creados"
2752# Notes:
2853# gcc -o libserial.so -shared -fPIC -Wall -Ilua -Llua -llua -Llibserialport/.libs -lserialport libserial.c
2954# gcc -o mi_aplicacion main.c -I./libserialport -L./libserialport/.libs -lserialport -static
You can’t perform that action at this time.
0 commit comments