Introduction
Introduction Statistics Contact Development Disclaimer Help
Port build system to MinGW-W64/Cygwin - libgrapheme - unicode string library
git clone git://git.suckless.org/libgrapheme
Log
Files
Refs
README
LICENSE
---
commit 0e95e5c797b1dc41117e1ea5455f2a7f2932868d
parent 53f5421ae389b0312bdcab1c715a03f175a58b07
Author: Laslo Hunhold <[email protected]>
Date: Thu, 23 Feb 2023 23:16:46 +0100
Port build system to MinGW-W64/Cygwin
This requires the ability to specify executable-suffixes. We trick a
bit by not diving into the import library madness for MSVC and instead
act as if we exported the import library "libgrapheme.lib", which
however is just the static library.
Signed-off-by: Laslo Hunhold <[email protected]>
Diffstat:
M Makefile | 108 ++++++++++++++++-------------…
M config.mk | 7 +++++--
M configure | 38 +++++++++++++++++++++--------…
3 files changed, 85 insertions(+), 68 deletions(-)
---
diff --git a/Makefile b/Makefile
@@ -109,7 +109,7 @@ MAN3 =\
MAN7 =\
man/libgrapheme\
-all: data/LICENSE $(MAN3:=.3) $(MAN7:=.7) libgrapheme.a $(SONAME)
+all: data/LICENSE $(MAN3:=.3) $(MAN7:=.7) $(ANAME) $(SONAME)
data/BidiBrackets.txt:
wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/BidiB…
@@ -206,44 +206,44 @@ test/utf8-decode.o: test/utf8-decode.c Makefile config.mk…
test/util.o: test/util.c Makefile config.mk test/util.h
test/word.o: test/word.c Makefile config.mk gen/word-test.h grapheme.h test/ut…
-benchmark/bidirectional: benchmark/bidirectional.o benchmark/util.o libgraphem…
-benchmark/case: benchmark/case.o benchmark/util.o libgrapheme.a
-benchmark/character: benchmark/character.o benchmark/util.o libgrapheme.a
-benchmark/line: benchmark/line.o benchmark/util.o libgrapheme.a
-benchmark/sentence: benchmark/sentence.o benchmark/util.o libgrapheme.a
-benchmark/utf8-decode: benchmark/utf8-decode.o benchmark/util.o libgrapheme.a
-benchmark/word: benchmark/word.o benchmark/util.o libgrapheme.a
-gen/bidirectional: gen/bidirectional.o gen/util.o
-gen/bidirectional-test: gen/bidirectional-test.o gen/util.o
-gen/case: gen/case.o gen/util.o
-gen/character: gen/character.o gen/util.o
-gen/character-test: gen/character-test.o gen/util.o
-gen/line: gen/line.o gen/util.o
-gen/line-test: gen/line-test.o gen/util.o
-gen/sentence: gen/sentence.o gen/util.o
-gen/sentence-test: gen/sentence-test.o gen/util.o
-gen/word: gen/word.o gen/util.o
-gen/word-test: gen/word-test.o gen/util.o
-test/bidirectional: test/bidirectional.o test/util.o libgrapheme.a
-test/case: test/case.o test/util.o libgrapheme.a
-test/character: test/character.o test/util.o libgrapheme.a
-test/line: test/line.o test/util.o libgrapheme.a
-test/sentence: test/sentence.o test/util.o libgrapheme.a
-test/utf8-encode: test/utf8-encode.o test/util.o libgrapheme.a
-test/utf8-decode: test/utf8-decode.o test/util.o libgrapheme.a
-test/word: test/word.o test/util.o libgrapheme.a
-
-gen/bidirectional.h: data/BidiBrackets.txt data/BidiMirroring.txt data/Derived…
-gen/bidirectional-test.h: data/BidiCharacterTest.txt data/BidiTest.txt gen/bid…
-gen/case.h: data/DerivedCoreProperties.txt data/UnicodeData.txt data/SpecialCa…
-gen/character.h: data/emoji-data.txt data/GraphemeBreakProperty.txt gen/charac…
-gen/character-test.h: data/GraphemeBreakTest.txt gen/character-test
-gen/line.h: data/emoji-data.txt data/EastAsianWidth.txt data/LineBreak.txt gen…
-gen/line-test.h: data/LineBreakTest.txt gen/line-test
-gen/sentence.h: data/SentenceBreakProperty.txt gen/sentence
-gen/sentence-test.h: data/SentenceBreakTest.txt gen/sentence-test
-gen/word.h: data/WordBreakProperty.txt gen/word
-gen/word-test.h: data/WordBreakTest.txt gen/word-test
+benchmark/bidirectional$(BINSUFFIX): benchmark/bidirectional.o benchmark/util.…
+benchmark/case$(BINSUFFIX): benchmark/case.o benchmark/util.o $(ANAME)
+benchmark/character$(BINSUFFIX): benchmark/character.o benchmark/util.o $(ANAM…
+benchmark/line$(BINSUFFIX): benchmark/line.o benchmark/util.o $(ANAME)
+benchmark/sentence$(BINSUFFIX): benchmark/sentence.o benchmark/util.o $(ANAME)
+benchmark/utf8-decode$(BINSUFFIX): benchmark/utf8-decode.o benchmark/util.o $(…
+benchmark/word$(BINSUFFIX): benchmark/word.o benchmark/util.o $(ANAME)
+gen/bidirectional$(BINSUFFIX): gen/bidirectional.o gen/util.o
+gen/bidirectional-test$(BINSUFFIX): gen/bidirectional-test.o gen/util.o
+gen/case$(BINSUFFIX): gen/case.o gen/util.o
+gen/character$(BINSUFFIX): gen/character.o gen/util.o
+gen/character-test$(BINSUFFIX): gen/character-test.o gen/util.o
+gen/line$(BINSUFFIX): gen/line.o gen/util.o
+gen/line-test$(BINSUFFIX): gen/line-test.o gen/util.o
+gen/sentence$(BINSUFFIX): gen/sentence.o gen/util.o
+gen/sentence-test$(BINSUFFIX): gen/sentence-test.o gen/util.o
+gen/word$(BINSUFFIX): gen/word.o gen/util.o
+gen/word-test$(BINSUFFIX): gen/word-test.o gen/util.o
+test/bidirectional$(BINSUFFIX): test/bidirectional.o test/util.o $(ANAME)
+test/case$(BINSUFFIX): test/case.o test/util.o $(ANAME)
+test/character$(BINSUFFIX): test/character.o test/util.o $(ANAME)
+test/line$(BINSUFFIX): test/line.o test/util.o $(ANAME)
+test/sentence$(BINSUFFIX): test/sentence.o test/util.o $(ANAME)
+test/utf8-encode$(BINSUFFIX): test/utf8-encode.o test/util.o $(ANAME)
+test/utf8-decode$(BINSUFFIX): test/utf8-decode.o test/util.o $(ANAME)
+test/word$(BINSUFFIX): test/word.o test/util.o $(ANAME)
+
+gen/bidirectional.h: data/BidiBrackets.txt data/BidiMirroring.txt data/Derived…
+gen/bidirectional-test.h: data/BidiCharacterTest.txt data/BidiTest.txt gen/bid…
+gen/case.h: data/DerivedCoreProperties.txt data/UnicodeData.txt data/SpecialCa…
+gen/character.h: data/emoji-data.txt data/GraphemeBreakProperty.txt gen/charac…
+gen/character-test.h: data/GraphemeBreakTest.txt gen/character-test$(BINSUFFIX)
+gen/line.h: data/emoji-data.txt data/EastAsianWidth.txt data/LineBreak.txt gen…
+gen/line-test.h: data/LineBreakTest.txt gen/line-test$(BINSUFFIX)
+gen/sentence.h: data/SentenceBreakProperty.txt gen/sentence$(BINSUFFIX)
+gen/sentence-test.h: data/SentenceBreakTest.txt gen/sentence-test$(BINSUFFIX)
+gen/word.h: data/WordBreakProperty.txt gen/word$(BINSUFFIX)
+gen/word-test.h: data/WordBreakTest.txt gen/word-test$(BINSUFFIX)
man/grapheme_is_character_break.3: man/grapheme_is_character_break.sh Makefile…
man/grapheme_is_uppercase.3: man/grapheme_is_uppercase.sh man/template/is_case…
@@ -280,19 +280,19 @@ $(BENCHMARK:=.o) benchmark/util.o $(TEST:=.o) test/util.o:
$(SRC:=.o):
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(SHFLAGS) $(@:.o=.c)
-$(BENCHMARK):
- $(CC) -o $@ $(LDFLAGS) [email protected] benchmark/util.o libgrapheme.a -lutf8proc
+$(BENCHMARK:=$(BINSUFFIX)):
+ $(CC) -o $@ $(LDFLAGS) $(@:$(BINSUFFIX)=.o) benchmark/util.o $(ANAME) …
-$(GEN):
- $(BUILD_CC) -o $@ $(BUILD_LDFLAGS) [email protected] gen/util.o
+$(GEN:=$(BINSUFFIX)):
+ $(BUILD_CC) -o $@ $(BUILD_LDFLAGS) $(@:$(BINSUFFIX)=.o) gen/util.o
-$(TEST):
- $(CC) -o $@ $(LDFLAGS) [email protected] test/util.o libgrapheme.a
+$(TEST:=$(BINSUFFIX)):
+ $(CC) -o $@ $(LDFLAGS) $(@:$(BINSUFFIX)=.o) test/util.o $(ANAME)
$(GEN:=.h):
- $(@:.h=) > $@
+ $(@:.h=$(BINSUFFIX)) > $@
-libgrapheme.a: $(SRC:=.o)
+$(ANAME): $(SRC:=.o)
$(AR) -rc $@ $?
$(RANLIB) $@
@@ -305,13 +305,13 @@ $(MAN3:=.3):
$(MAN7:=.7):
SH="$(SH)" MAN_DATE="$(MAN_DATE)" UNICODE_VERSION="$(UNICODE_VERSION)"…
-benchmark: $(BENCHMARK)
- for m in $(BENCHMARK); do ./$$m; done
+benchmark: $(BENCHMARK:=$(BINSUFFIX))
+ for m in $(BENCHMARK:=$(BINSUFFIX)); do ./$$m; done
check: test
-test: $(TEST)
- for m in $(TEST); do ./$$m; done
+test: $(TEST:=$(BINSUFFIX))
+ for m in $(TEST:=$(BINSUFFIX)); do ./$$m; done
install: all
mkdir -p "$(DESTDIR)$(LIBPREFIX)"
@@ -320,7 +320,7 @@ install: all
mkdir -p "$(DESTDIR)$(MANPREFIX)/man7"
cp -f $(MAN3:=.3) "$(DESTDIR)$(MANPREFIX)/man3"
cp -f $(MAN7:=.7) "$(DESTDIR)$(MANPREFIX)/man7"
- cp -f libgrapheme.a "$(DESTDIR)$(LIBPREFIX)"
+ cp -f $(ANAME) "$(DESTDIR)$(LIBPREFIX)"
cp -f $(SONAME) "$(DESTDIR)$(LIBPREFIX)/$(SONAME)"
if [ "$(SOSYMLINK)" = "true" ]; then i=0; while [ "$$i" -le $(VERSION_…
if [ "$(SOSYMLINK)" = "true" ]; then ln -sf "$(SONAME)" "$(DESTDIR)$(L…
@@ -332,7 +332,7 @@ install: all
uninstall:
for m in $(MAN3:=.3); do rm -f "$(DESTDIR)$(MANPREFIX)/man3/`basename …
for m in $(MAN7:=.7); do rm -f "$(DESTDIR)$(MANPREFIX)/man7/`basename …
- rm -f "$(DESTDIR)$(LIBPREFIX)/libgrapheme.a"
+ rm -f "$(DESTDIR)$(LIBPREFIX)/$(ANAME)"
rm -f "$(DESTDIR)$(LIBPREFIX)/$(SONAME)"
if [ "$(SOSYMLINK)" = "true" ]; then i=0; while [ "$$i" -le $(VERSION_…
if [ "$(SOSYMLINK)" = "true" ]; then rm -f "$(DESTDIR)$(LIBPREFIX)/lib…
@@ -342,7 +342,7 @@ uninstall:
if ! [ -z "$(PCPREFIX)" ]; then rm -f "$(DESTDIR)$(PCPREFIX)/libgraphe…
clean:
- rm -f $(BENCHMARK:=.o) benchmark/util.o $(BENCHMARK) $(GEN:=.h) $(GEN:…
+ rm -f $(BENCHMARK:=.o) benchmark/util.o $(BENCHMARK:=$(BINSUFFIX)) $(G…
clean-data:
rm -f $(DATA)
diff --git a/config.mk b/config.mk
@@ -8,6 +8,11 @@ LIBPREFIX = $(PREFIX)/lib
MANPREFIX = $(PREFIX)/share/man
PCPREFIX = $(LIBPREFIX)/pkgconfig
+# names
+ANAME = libgrapheme.a
+SONAME = libgrapheme.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
+BINSUFFIX =
+
# flags
CPPFLAGS = -D_DEFAULT_SOURCE
CFLAGS = -std=c99 -Os -Wall -Wextra -Wpedantic
@@ -18,9 +23,7 @@ BUILD_CFLAGS = $(CFLAGS)
BUILD_LDFLAGS = $(LDFLAGS)
SHFLAGS = -fPIC -ffreestanding
-
SOFLAGS = -shared -nostdlib -Wl,--soname=libgrapheme.so.$(VERSION_MAJOR).$(V…
-SONAME = libgrapheme.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
SOSYMLINK = true
# tools (unset $LDCONFIG to not call ldconfig(1) after install/uninstall)
diff --git a/configure b/configure
@@ -13,22 +13,36 @@ replace_line()
case $(uname) in
DragonFly|FreeBSD|Linux|MidnightBSD|NetBSD)
# the default
- replace_line 'SOFLAGS' ' ' '-shared -nostdlib -Wl,--soname…
- replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJOR…
- replace_line 'SOSYMLINK' '' 'true'
- replace_line 'LDCONFIG' '' 'ldconfig'
+ replace_line 'ANAME' ' ' 'libgrapheme.a'
+ replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJO…
+ replace_line 'BINSUFFIX' '' ''
+ replace_line 'SOFLAGS' ' ' '-shared -nostdlib -Wl,--sonam…
+ replace_line 'SOSYMLINK' '' 'true'
+ replace_line 'LDCONFIG' '' 'ldconfig'
;;
OpenBSD)
- replace_line 'SOFLAGS' ' ' '-shared -nostdlib'
- replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJOR…
- replace_line 'SOSYMLINK' '' 'false'
- replace_line 'LDCONFIG' '' ''
+ replace_line 'ANAME' ' ' 'libgrapheme.a'
+ replace_line 'SONAME' ' ' 'libgrapheme.so.$(VERSION_MAJO…
+ replace_line 'BINSUFFIX' '' ''
+ replace_line 'SOFLAGS' ' ' '-shared -nostdlib'
+ replace_line 'SOSYMLINK' '' 'false'
+ replace_line 'LDCONFIG' '' ''
;;
Darwin)
- replace_line 'SOFLAGS' ' ' '-dynamiclib -install_name libg…
- replace_line 'SONAME' ' ' 'libgrapheme.$(VERSION_MAJOR).d…
- replace_line 'SOSYMLINK' '' 'false'
- replace_line 'LDCONFIG' '' ''
+ replace_line 'ANAME' ' ' 'libgrapheme.a'
+ replace_line 'SONAME' ' ' 'libgrapheme.$(VERSION_MAJOR).…
+ replace_line 'BINSUFFIX' '' ''
+ replace_line 'SOFLAGS' ' ' '-dynamiclib -install_name lib…
+ replace_line 'SOSYMLINK' '' 'false'
+ replace_line 'LDCONFIG' '' ''
+ ;;
+ CYGWIN*|MSYS*|WINGW*)
+ replace_line 'ANAME' ' ' 'libgrapheme.lib'
+ replace_line 'SONAME' ' ' 'libgrapheme.dll'
+ replace_line 'BINSUFFIX' '' '.exe'
+ replace_line 'SOFLAGS' ' ' '-shared'
+ replace_line 'SOSYMLINK' '' 'false'
+ replace_line 'LDCONFIG' '' ''
;;
*)
echo "Your system does not have a preset. Edit config.mk and s…
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.