summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-08-23 18:19:20 +0100
committerVincent Sanders <vince@kyllikki.org>2018-08-23 18:19:20 +0100
commit282f8e43de41a586a126dac07fec36f50b78c60f (patch)
tree305cf088a688c48ec388155ab47477aa5936a1d9
parent97ef668b312b96382714dbb8eaac4affce0816e6 (diff)
downloadlibutf8proc-release/2.2.0-1.tar.gz
libutf8proc-release/2.2.0-1.tar.bz2
Build with core netsurf buildsystemrelease/2.2.0-1
-rw-r--r--.gitattributes2
-rw-r--r--.gitignore2
-rw-r--r--Makefile194
-rw-r--r--README15
-rw-r--r--bench/Makefile39
-rw-r--r--data/Makefile69
-rw-r--r--include/libutf8proc/utf8proc.h (renamed from utf8proc.h)6
-rw-r--r--libutf8proc.pc.in10
-rw-r--r--src/Makefile3
-rw-r--r--src/utf8proc.c (renamed from utf8proc.c)0
-rw-r--r--src/utf8proc_data.c (renamed from utf8proc_data.c)0
11 files changed, 84 insertions, 256 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..de2f316
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+.gitignore export-ignore
+.gitattributes export-ignore
diff --git a/.gitignore b/.gitignore
index 81f237e..8de78a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,5 @@ test/iterate
test/case
test/custom
/tmp/
+build-*
+Makefile.config.override
diff --git a/Makefile b/Makefile
index b03d94f..bbb719c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,153 +1,51 @@
-# libutf8proc Makefile
-
-# programs
-AR?=ar
-CC?=gcc
-INSTALL=install
-FIND=find
-
-# compiler settings
-CFLAGS ?= -O2
-PICFLAG = -fPIC
-C99FLAG = -std=c99
-WCFLAGS = -Wall -pedantic
-UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS $(UTF8PROC_DEFINES)
-
-# shared-library version MAJOR.MINOR.PATCH ... this may be *different*
-# from the utf8proc version number because it indicates ABI compatibility,
-# not API compatibility: MAJOR should be incremented whenever *binary*
-# compatibility is broken, even if the API is backward-compatible.
-# The API version number is defined in utf8proc.h.
-# Be sure to also update these ABI versions in MANIFEST and CMakeLists.txt!
-MAJOR=2
-MINOR=2
-PATCH=0
-
-OS := $(shell uname)
-ifeq ($(OS),Darwin) # MacOS X
- SHLIB_EXT = dylib
- SHLIB_VERS_EXT = $(MAJOR).dylib
-else # GNU/Linux, at least (Windows should probably use cmake)
- SHLIB_EXT = so
- SHLIB_VERS_EXT = so.$(MAJOR).$(MINOR).$(PATCH)
+#!/bin/make
+#
+# Makefile for libutf8proc
+#
+# Copyright 2009-2015 John-Mark Bell <jmb@netsurf-browser.org>
+
+# Component settings
+COMPONENT := utf8proc
+COMPONENT_VERSION := 2.2.0-1
+# Default to a static library
+COMPONENT_TYPE ?= lib-static
+
+# Setup the tooling
+PREFIX ?= /opt/netsurf
+NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem
+include $(NSSHARED)/makefiles/Makefile.tools
+
+# Reevaluate when used, as BUILDDIR won't be defined yet
+TESTRUNNER = $(BUILDDIR)/test_testrunner$(EXEEXT)
+
+# Toolchain flags
+WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs
+
+CFLAGS := -I$(CURDIR)/include/libutf8proc/ -I$(CURDIR)/src \
+ -DUTF8PROC_EXPORTS \
+ $(WARNFLAGS) $(CFLAGS)
+ifneq ($(GCCVER),2)
+ CFLAGS := $(CFLAGS) -std=c99
+else
+ # __inline__ is a GCCism
+ CFLAGS := $(CFLAGS) -Dinline="__inline__"
endif
-# installation directories (for 'make install')
-prefix=/usr/local
-libdir=$(prefix)/lib
-includedir=$(prefix)/include
-
-# meta targets
-
-.PHONY: all clean data update manifest install
-
-all: libutf8proc.a libutf8proc.$(SHLIB_EXT)
-
-clean:
- rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.$(SHLIB_EXT)
-ifneq ($(OS),Darwin)
- rm -f libutf8proc.so.$(MAJOR)
-endif
- rm -f test/tests.o test/normtest test/graphemetest test/printproperty test/charwidth test/valid test/iterate test/case test/custom test/misc
- rm -rf MANIFEST.new tmp
- $(MAKE) -C bench clean
- $(MAKE) -C data clean
-
-data: data/utf8proc_data.c.new
-
-update: data/utf8proc_data.c.new
- cp -f data/utf8proc_data.c.new utf8proc_data.c
-
-manifest: MANIFEST.new
-
-# real targets
-
-data/utf8proc_data.c.new: libutf8proc.$(SHLIB_EXT) data/data_generator.rb data/charwidths.jl
- $(MAKE) -C data utf8proc_data.c.new
-
-utf8proc.o: utf8proc.h utf8proc.c utf8proc_data.c
- $(CC) $(UCFLAGS) -c -o utf8proc.o utf8proc.c
-
-libutf8proc.a: utf8proc.o
- rm -f libutf8proc.a
- $(AR) rs libutf8proc.a utf8proc.o
-
-libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH): utf8proc.o
- $(CC) $(LDFLAGS) -shared -o $@ -Wl,-soname -Wl,libutf8proc.so.$(MAJOR) utf8proc.o
- chmod a-x $@
+include $(NSBUILD)/Makefile.top
-libutf8proc.so: libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH)
- ln -f -s libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH) $@
- ln -f -s libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH) $@.$(MAJOR)
-
-libutf8proc.$(MAJOR).dylib: utf8proc.o
- $(CC) $(LDFLAGS) -dynamiclib -o $@ $^ -install_name $(libdir)/$@ -Wl,-compatibility_version -Wl,$(MAJOR) -Wl,-current_version -Wl,$(MAJOR).$(MINOR).$(PATCH)
-
-libutf8proc.dylib: libutf8proc.$(MAJOR).dylib
- ln -f -s libutf8proc.$(MAJOR).dylib $@
-
-install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT)
- mkdir -m 755 -p $(DESTDIR)$(includedir)
- $(INSTALL) -m 644 utf8proc.h $(DESTDIR)$(includedir)
- mkdir -m 755 -p $(DESTDIR)$(libdir)
- $(INSTALL) -m 644 libutf8proc.a $(DESTDIR)$(libdir)
- $(INSTALL) -m 755 libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)
- ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.$(SHLIB_EXT)
-ifneq ($(OS),Darwin)
- ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR)
+ifeq ($(WANT_TEST),yes)
+ ifneq ($(PKGCONFIG),)
+ TESTCFLAGS := $(TESTCFLAGS) $(shell $(PKGCONFIG) --cflags check)
+ TESTLDFLAGS := $(TESTLDFLAGS) $(shell $(PKGCONFIG) --libs check)
+ else
+ TESTLDFLAGS := $(TESTLDFLAGS) -lcheck
+ endif
endif
-MANIFEST.new:
- rm -rf tmp
- $(MAKE) install prefix=/usr DESTDIR=$(PWD)/tmp
- $(FIND) tmp/usr -mindepth 1 -type l -printf "%P -> %l\n" -or -type f -printf "%P\n" -or -type d -printf "%P/\n" | LC_ALL=C sort > $@
- rm -rf tmp
-
-# Test programs
-
-data/NormalizationTest.txt:
- $(MAKE) -C data NormalizationTest.txt
-
-data/GraphemeBreakTest.txt:
- $(MAKE) -C data GraphemeBreakTest.txt
-
-test/tests.o: test/tests.c test/tests.h utf8proc.h
- $(CC) $(UCFLAGS) -c -o test/tests.o test/tests.c
-
-test/normtest: test/normtest.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/normtest.c test/tests.o utf8proc.o -o $@
-
-test/graphemetest: test/graphemetest.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/graphemetest.c test/tests.o utf8proc.o -o $@
-
-test/printproperty: test/printproperty.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/printproperty.c test/tests.o utf8proc.o -o $@
-
-test/charwidth: test/charwidth.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/charwidth.c test/tests.o utf8proc.o -o $@
-
-test/valid: test/valid.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/valid.c test/tests.o utf8proc.o -o $@
-
-test/iterate: test/iterate.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/iterate.c test/tests.o utf8proc.o -o $@
-
-test/case: test/case.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/case.c test/tests.o utf8proc.o -o $@
-
-test/custom: test/custom.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/custom.c test/tests.o utf8proc.o -o $@
-
-test/misc: test/misc.c test/tests.o utf8proc.o utf8proc.h test/tests.h
- $(CC) $(UCFLAGS) test/misc.c test/tests.o utf8proc.o -o $@
-
-check: test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/custom test/charwidth test/misc test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o
- $(MAKE) -C bench
- test/normtest data/NormalizationTest.txt
- test/graphemetest data/GraphemeBreakTest.txt
- test/charwidth
- test/misc
- test/valid
- test/iterate
- test/case
- test/custom
+# Extra installation rules
+I := /$(INCLUDEDIR)/libutf8proc
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libutf8proc/utf8proc.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in
+INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT)
diff --git a/README b/README
new file mode 100644
index 0000000..a260a0e
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+libutf8proc
+===========
+
+This is the Public software group utf8proc library [1] repackaged as a
+conveniance library for NetSurf. Previously this library was simply
+copied into the NetSurf sources.
+
+This takes the unicode 11 capable version 2.2.0 of the library and
+converts it to the NetSurf build system which adds the generation of a
+pkg-config file. There are no code changes from upstream.
+
+All the Makefiles and changes are licenced as per the utf8proc
+source using the MIT "expat" licence.
+
+[1] https://github.com/JuliaStrings/utf8proc
diff --git a/bench/Makefile b/bench/Makefile
deleted file mode 100644
index ea12dcb..0000000
--- a/bench/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-CURL=curl
-
-CC = cc
-CFLAGS = -O2 -std=c99 -pedantic -Wall
-
-all: bench
-
-LIBUTF8PROC = ../utf8proc.o
-
-bench: bench.o util.o $(LIBUTF8PROC)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ bench.o util.o $(LIBUTF8PROC)
-
-DATAURL = https://raw.githubusercontent.com/duerst/eprun/master/benchmark
-DATAFILES = Deutsch_.txt Japanese_.txt Korean_.txt Vietnamese_.txt
-
-$(DATAFILES):
- $(CURL) -O $(DATAURL)/$@
-
-bench.out: $(DATAFILES) bench
- ./bench -nfkc $(DATAFILES) > $@
-
-# you may need make CPPFLAGS=... LDFLAGS=... to help it find ICU
-icu: icu.o util.o
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ icu.o util.o -licuuc
-
-icu.out: $(DATAFILES) icu
- ./icu $(DATAFILES) > $@
-
-unistring: unistring.o util.o
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ unistring.o util.o -lunistring
-
-unistring.out: $(DATAFILES) unistring
- ./unistring $(DATAFILES) > $@
-
-.c.o:
- $(CC) $(CPPFLAGS) -I.. $(CFLAGS) -c -o $@ $<
-
-clean:
- rm -rf *.o *.txt bench *.out icu unistring
diff --git a/data/Makefile b/data/Makefile
deleted file mode 100644
index 1b24728..0000000
--- a/data/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# Unicode data generation rules. Except for the test data files, most
-# users will not use these Makefile rules, which are primarily to re-generate
-# unicode_data.c when we get a new Unicode version or charwidth data; they
-# require ruby, fontforge, and julia to be installed.
-
-# programs
-CURL=curl
-RUBY=ruby
-PERL=perl
-MAKE=make
-JULIA=julia
-FONTFORGE=fontforge
-CURLFLAGS = --retry 5 --location
-
-.PHONY: clean
-
-.DELETE_ON_ERROR:
-
-utf8proc_data.c.new: data_generator.rb UnicodeData.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt CharWidths.txt emoji-data.txt
- $(RUBY) data_generator.rb < UnicodeData.txt > $@
-
-# GNU Unifont version for font metric calculations:
-UNIFONT_VERSION=11.0.01
-
-unifont.ttf:
- $(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://mirrors.kernel.org/gnu/unifont/unifont-$(UNIFONT_VERSION)/unifont-$(UNIFONT_VERSION).ttf
-
-unifont_upper.ttf:
- $(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://mirrors.kernel.org/gnu/unifont/unifont-$(UNIFONT_VERSION)/unifont_upper-$(UNIFONT_VERSION).ttf
-
-%.sfd: %.ttf
- $(FONTFORGE) -lang=ff -c "Open(\"$<\");Save(\"$@\");Quit(0);"
-
-CharWidths.txt: charwidths.jl unifont.sfd unifont_upper.sfd EastAsianWidth.txt
- $(JULIA) charwidths.jl > $@
-
-# Unicode data version
-UNICODE_VERSION=11.0.0
-
-UnicodeData.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/UnicodeData.txt
-
-EastAsianWidth.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/EastAsianWidth.txt
-
-GraphemeBreakProperty.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakProperty.txt
-
-DerivedCoreProperties.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/DerivedCoreProperties.txt
-
-CompositionExclusions.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/CompositionExclusions.txt
-
-CaseFolding.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/CaseFolding.txt
-
-NormalizationTest.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/NormalizationTest.txt
-
-GraphemeBreakTest.txt:
- $(CURL) $(CURLFLAGS) $(URLCACHE)http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakTest.txt | $(PERL) -pe 's,÷,/,g;s,×,+,g' > $@
-
-emoji-data.txt:
- $(CURL) $(CURLFLAGS) -o $@ -O $(URLCACHE)http://unicode.org/Public/emoji/`echo $(UNICODE_VERSION) | cut -d. -f1-2`/emoji-data.txt
-
-clean:
- rm -f UnicodeData.txt EastAsianWidth.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt GraphemeBreakTest.txt CharWidths.txt unifont*.ttf unifont*.sfd emoji-data.txt
- rm -f utf8proc_data.c.new
diff --git a/utf8proc.h b/include/libutf8proc/utf8proc.h
index f5cc1e1..1fd79c6 100644
--- a/utf8proc.h
+++ b/include/libutf8proc/utf8proc.h
@@ -552,6 +552,12 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *buffer, utf8proc_ssize_t length, utf8proc_option_t options);
/**
+ * Reencodes the sequence of unicode characters given by the pointer
+ * 'buffer' and 'length'. See utf8proc_reencode for further details.
+ */
+UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *buffer, utf8proc_ssize_t length, utf8proc_option_t options);
+
+/**
* Reencodes the sequence of `length` codepoints pointed to by `buffer`
* UTF-8 data in-place (i.e., the result is also stored in `buffer`).
* Can optionally normalize the UTF-32 sequence prior to UTF-8 conversion.
diff --git a/libutf8proc.pc.in b/libutf8proc.pc.in
new file mode 100644
index 0000000..be03a5a
--- /dev/null
+++ b/libutf8proc.pc.in
@@ -0,0 +1,10 @@
+prefix=PREFIX
+exec_prefix=${prefix}
+libdir=${exec_prefix}/LIBDIR
+includedir=${prefix}/INCLUDEDIR
+
+Name: libutf8proc
+Description: UTF8 processing
+Version: VERSION
+Libs: -L${libdir} -lutf8proc
+Cflags: -I${includedir} -DUTF8PROC_EXPORTS
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..5e80c79
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,3 @@
+DIR_SOURCES := utf8proc.c
+
+include $(NSBUILD)/Makefile.subdir
diff --git a/utf8proc.c b/src/utf8proc.c
index f03126c..f03126c 100644
--- a/utf8proc.c
+++ b/src/utf8proc.c
diff --git a/utf8proc_data.c b/src/utf8proc_data.c
index bb3622f..bb3622f 100644
--- a/utf8proc_data.c
+++ b/src/utf8proc_data.c