mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 14:43:28 +00:00
build libiconv from sources
This commit is contained in:
committed by
Francis Bouvier
parent
b5b4659c87
commit
d7fec31b8a
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,4 +3,5 @@ zig-out
|
||||
/vendor/lexbor/
|
||||
/vendor/netsurf/build/
|
||||
/vendor/netsurf/lib/
|
||||
/vendor/netsurf/include/
|
||||
/vendor/netsurf/include/
|
||||
/vendor/libiconv/
|
||||
|
||||
25
Makefile
25
Makefile
@@ -55,30 +55,28 @@ test:
|
||||
# Install and build required dependencies commands
|
||||
# ------------
|
||||
.PHONY: install-submodule
|
||||
.PHONY: install-lexbor install-jsruntime install-jsruntime-dev
|
||||
.PHONY: install-lexbor install-jsruntime install-jsruntime-dev install-libiconv
|
||||
.PHONY: install-netsurf clean-netsurf test-netsurf
|
||||
.PHONY: install-dev install
|
||||
|
||||
## Install and build dependencies for release
|
||||
install: install-submodule install-lexbor install-jsruntime
|
||||
install: install-submodule install-lexbor install-jsruntime install-netsurf
|
||||
|
||||
## Install and build dependencies for dev
|
||||
install-dev: install-submodule install-lexbor install-jsruntime-dev
|
||||
install-dev: install-submodule install-lexbor install-jsruntime-dev install-netsurf
|
||||
|
||||
BC_NS := $(BC)vendor/netsurf
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
ICONV := /opt/homebrew/opt/libiconv
|
||||
endif
|
||||
ICONV := $(BC)vendor/libiconv
|
||||
# TODO: add Linux iconv path (I guess it depends on the distro)
|
||||
# TODO: this way of linking libiconv is not ideal. We should have a more generic way
|
||||
# and stick to a specif version. Maybe build from source. Anyway not now.
|
||||
install-netsurf:
|
||||
install-netsurf: install-libiconv
|
||||
@printf "\e[36mInstalling NetSurf...\e[0m\n" && \
|
||||
ls $(ICONV) 1> /dev/null || (printf "\e[33mERROR: you need to install libiconv in your system (on MacOS on with Homebrew)\e[0m\n"; exit 1;) && \
|
||||
export PREFIX=$(BC_NS) && \
|
||||
export LDFLAGS="-L$(ICONV)/lib" && \
|
||||
export CFLAGS="-I$(ICONV)/include" && \
|
||||
export OPTLDFLAGS="-L$(ICONV)/lib" && \
|
||||
export OPTCFLAGS="-I$(ICONV)/include" && \
|
||||
printf "\e[33mInstalling libwapcaplet...\e[0m\n" && \
|
||||
cd vendor/netsurf/libwapcaplet && \
|
||||
BUILDDIR=$(BC_NS)/build/libwapcaplet make install && \
|
||||
@@ -124,6 +122,15 @@ test-netsurf:
|
||||
cd vendor/netsurf/libdom && \
|
||||
BUILDDIR=$(BC_NS)/build/libdom make test
|
||||
|
||||
install-libiconv:
|
||||
ifeq ("$(wildcard vendor/libiconv/lib/libiconv.a)","")
|
||||
@mkdir -p vendor/libiconv
|
||||
@cd vendor/libiconv && \
|
||||
curl https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz | tar -xvzf -
|
||||
@cd vendor/libiconv/libiconv-1.17 && \
|
||||
./configure --prefix=$(BC)vendor/libiconv --enable-static && \
|
||||
make && make install
|
||||
endif
|
||||
|
||||
install-lexbor:
|
||||
@mkdir -p vendor/lexbor
|
||||
|
||||
10
README.md
10
README.md
@@ -18,7 +18,8 @@ For Debian/Ubuntu based Linux:
|
||||
sudo apt install xz-utils \
|
||||
python3 ca-certificates git \
|
||||
pkg-config libglib2.0-dev \
|
||||
cmake
|
||||
libexpat1-dev \
|
||||
cmake clang
|
||||
```
|
||||
|
||||
For MacOS, you only need Python 3 and cmake.
|
||||
@@ -35,6 +36,13 @@ directory.
|
||||
make install-submodule
|
||||
```
|
||||
|
||||
### Build netsurf
|
||||
|
||||
The command `make install-netsurf` will build netsurf libs used by browsercore.
|
||||
```
|
||||
make install-netsurf
|
||||
```
|
||||
|
||||
### Build lexbor
|
||||
|
||||
The command `make install-lexbor` will build lexbor lib used by browsercore.
|
||||
|
||||
13
build.zig
13
build.zig
@@ -91,17 +91,8 @@ fn linkLexbor(step: *std.build.LibExeObjStep) void {
|
||||
fn linkNetSurf(step: *std.build.LibExeObjStep) void {
|
||||
|
||||
// iconv
|
||||
var iconv_lib: []const u8 = undefined;
|
||||
var iconv_include: []const u8 = undefined;
|
||||
const os = step.target.getOsTag();
|
||||
if (os == .macos) {
|
||||
iconv_lib = "/opt/homebrew/opt/libiconv/lib/libiconv.a";
|
||||
iconv_include = "/opt/homebrew/opt/libiconv/include";
|
||||
} else if (os == .linux) {
|
||||
@panic("you need to modify build.zig to specify libiconv paths");
|
||||
}
|
||||
step.addObjectFile(.{ .path = iconv_lib });
|
||||
step.addIncludePath(.{ .path = iconv_include });
|
||||
step.addObjectFile(.{ .path = "vendor/libiconv/lib/libiconv.a" });
|
||||
step.addIncludePath(.{ .path = "vendor/libiconv/include" });
|
||||
|
||||
// netsurf libs
|
||||
const ns = "vendor/netsurf/";
|
||||
|
||||
Reference in New Issue
Block a user