Skip to content

Commit

Permalink
[make] Add sqlite.hdll target (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobil4sk authored Apr 26, 2022
1 parent 55f3609 commit 880b81d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ jobs:
libuv1-dev:i386 \
libvorbis-dev:i386 \
libz-dev:i386 \
zlib1g-dev:i386
zlib1g-dev:i386 \
libsqlite3-dev:i386
;;
linux-amd64)
Expand All @@ -109,7 +110,8 @@ jobs:
libsdl2-dev \
libturbojpeg-dev \
libuv1-dev \
libvorbis-dev
libvorbis-dev \
libsqlite3-dev
;;
darwin*)
Expand Down
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ brew "openal-soft"
brew "mbedtls@2", link: true
brew "libuv"
brew "openssl"
brew "sqlite"
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ INSTALL_BIN_DIR ?= $(PREFIX)/bin
INSTALL_LIB_DIR ?= $(PREFIX)/lib
INSTALL_INCLUDE_DIR ?= $(PREFIX)/include

LIBS=fmt sdl ssl openal ui uv mysql
LIBS=fmt sdl ssl openal ui uv mysql sqlite

CFLAGS = -Wall -O3 -I src -msse2 -mfpmath=sse -std=c11 -I include -I include/pcre -I include/mikktspace -I include/minimp3 -D LIBHL_EXPORTS
CFLAGS = -Wall -O3 -I src -msse2 -mfpmath=sse -std=c11 -D LIBHL_EXPORTS
LFLAGS = -L. -lhl
EXTRA_LFLAGS ?=
LIBFLAGS =
HLFLAGS = -ldl
LIBEXT = so
LIBTURBOJPEG = -lturbojpeg

PCRE_INCLUDE = -I include/pcre

PCRE = include/pcre/pcre_chartables.o include/pcre/pcre_compile.o include/pcre/pcre_dfa_exec.o \
include/pcre/pcre_exec.o include/pcre/pcre_fullinfo.o include/pcre/pcre_globals.o \
include/pcre/pcre_newline.o include/pcre/pcre_string_utils.o include/pcre/pcre_tables.o include/pcre/pcre_xclass.o \
Expand All @@ -31,6 +33,8 @@ STD = src/std/array.o src/std/buffer.o src/std/bytes.o src/std/cast.o src/std/da

HL = src/code.o src/jit.o src/main.o src/module.o src/debugger.o src/profile.o

FMT_INCLUDE = -I include/mikktspace -I include/minimp3

FMT = libs/fmt/fmt.o libs/fmt/sha1.o include/mikktspace/mikktspace.o libs/fmt/mikkt.o libs/fmt/dxt.o

SDL = libs/sdl/sdl.o libs/sdl/gl.o
Expand All @@ -45,6 +49,8 @@ UI = libs/ui/ui_stub.o

MYSQL = libs/mysql/socket.o libs/mysql/sha1.o libs/mysql/my_proto.o libs/mysql/my_api.o libs/mysql/mysql.o

SQLITE = libs/sqlite/sqlite.o

LIB = ${PCRE} ${RUNTIME} ${STD}

BOOT = src/_main.o
Expand All @@ -66,7 +72,9 @@ else ifeq ($(UNAME),Darwin)

# Mac
LIBEXT=dylib
CFLAGS += -m$(MARCH) -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include -I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include/SDL2 -I /usr/local/opt/libvorbis/include -I /usr/local/opt/openal-soft/include -Dopenal_soft -DGL_SILENCE_DEPRECATION
CFLAGS += -m$(MARCH) -I include -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include \
-I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include/SDL2 -I /usr/local/opt/libvorbis/include \
-I /usr/local/opt/openal-soft/include -Dopenal_soft -DGL_SILENCE_DEPRECATION
LFLAGS += -Wl,-export_dynamic -L/usr/local/lib

ifdef OSX_SDK
Expand Down Expand Up @@ -130,6 +138,12 @@ uninstall:

libs: $(LIBS)

./include/pcre/%.o: include/pcre/%.c
${CC} ${CFLAGS} -o $@ -c $< ${PCRE_FLAGS}

src/std/regexp.o: src/std/regexp.c
${CC} ${CFLAGS} -o $@ -c $< ${PCRE_FLAGS}

libhl: ${LIB}
${CC} -o libhl.$(LIBEXT) -m${MARCH} ${LIBFLAGS} -shared ${LIB} -lpthread -lm

Expand All @@ -139,8 +153,11 @@ hlc: ${BOOT}
hl: ${HL} libhl
${CC} ${CFLAGS} -o hl ${HL} ${LFLAGS} ${EXTRA_LFLAGS} ${HLFLAGS}

libs/fmt/%.o: libs/fmt/%.c
${CC} ${CFLAGS} -o $@ -c $< ${FMT_INCLUDE}

fmt: ${FMT} libhl
${CC} ${CFLAGS} -I include/mikktspace -I include/minimp3 -shared -o fmt.hdll ${FMT} ${LIBFLAGS} -L. -lhl -lpng $(LIBTURBOJPEG) -lz -lvorbisfile
${CC} ${CFLAGS} -shared -o fmt.hdll ${FMT} ${LIBFLAGS} -L. -lhl -lpng $(LIBTURBOJPEG) -lz -lvorbisfile

sdl: ${SDL} libhl
${CC} ${CFLAGS} -shared -o sdl.hdll ${SDL} ${LIBFLAGS} -L. -lhl -lSDL2 $(LIBOPENGL)
Expand All @@ -160,6 +177,9 @@ uv: ${UV} libhl
mysql: ${MYSQL} libhl
${CC} ${CFLAGS} -shared -o mysql.hdll ${MYSQL} ${LIBFLAGS} -L. -lhl

sqlite: ${SQLITE} libhl
${CC} ${CFLAGS} -shared -o sqlite.hdll ${SQLITE} ${LIBFLAGS} -L. -lhl -lsqlite3

mesa:
(cd libs/mesa && make)

Expand Down Expand Up @@ -224,7 +244,7 @@ codesign_osx:
${CC} ${CFLAGS} -o $@ -c $<

clean_o:
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${HL_DEBUG}
rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HL_DEBUG}

clean: clean_o
rm -f hl hl.exe libhl.$(LIBEXT) *.hdll
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
HashLink is distributed with some graphics libraries allowing to develop various applications, you can manually disable the libraries you want to compile in Makefile.
Here's the dependencies that you install in order to compile all the libraries:

* fmt: libpng-dev libturbojpeg-dev libvorbis-dev
* openal: libopenal-dev
* sdl: libsdl2-dev
* ssl: libmbedtls-dev
* uv: libuv1-dev
* fmt: libpng-dev libturbojpeg-dev libvorbis-dev
* openal: libopenal-dev
* sdl: libsdl2-dev
* ssl: libmbedtls-dev
* uv: libuv1-dev
* sqlite: libsqlite3-dev

To install all dependencies on the latest **Ubuntu**, for example:

`sudo apt-get install libpng-dev libturbojpeg-dev libvorbis-dev libopenal-dev libsdl2-dev libmbedtls-dev libuv1-dev`
`sudo apt-get install libpng-dev libturbojpeg-dev libvorbis-dev libopenal-dev libsdl2-dev libmbedtls-dev libuv1-dev libsqlite3-dev`

For 16.04, see [this note](https://github.com/HaxeFoundation/hashlink/issues/147).

To install all dependencies on the latest **Fedora**, for example:

`sudo dnf install libpng-devel turbojpeg-devel libvorbis-devel openal-soft-devel SDL2-devel mesa-libGLU-devel mbedtls-devel libuv-devel`
`sudo dnf install libpng-devel turbojpeg-devel libvorbis-devel openal-soft-devel SDL2-devel mesa-libGLU-devel mbedtls-devel libuv-devel sqlite-devel`

**And on OSX:**

Expand Down
4 changes: 3 additions & 1 deletion other/azure-pipelines/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
name: 'BuildLinux'
vmImage: 'ubuntu-18.04'
container: 'debian:stretch'
arch: '' # set it to i386 fof 32-bit build
arch: '' # set it to i386 for 32-bit build
buildSystem: 'cmake' # either 'cmake' or 'make'
cmakeConfig: 'RelWithDebInfo'

Expand Down Expand Up @@ -44,6 +44,7 @@ jobs:
libturbojpeg0-dev \
libuv1-dev \
libopenal-dev \
libsqlite3-dev \
neko \
curl \
ca-certificates
Expand All @@ -67,6 +68,7 @@ jobs:
libturbojpeg0-dev:i386 \
libuv1-dev:${{ parameters.arch }} \
libopenal-dev:${{ parameters.arch }} \
libsqlite3-dev:${{ parameters.arch }} \
neko \
curl \
ca-certificates
Expand Down

0 comments on commit 880b81d

Please sign in to comment.