Skip to content

Commit

Permalink
Add update-nfkc target
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 9, 2018
1 parent db9513f commit 615cacd
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
28 changes: 28 additions & 0 deletions lib/Makefile.am
Expand Up @@ -106,3 +106,31 @@ EXTRA_DIST = \
CMakeLists.txt

CLEANFILES = *.gcno *.gcda


ICU_VERSION_DOT = $$(echo $(ICU_VERSION) | sed -e 's/_/./g')

icu4c-$(ICU_VERSION)-src.tgz:
if [ -z "$(ICU_VERSION)" ]; then \
echo "Must define ICU_VERSION"; \
false; \
fi
wget \
http://download.icu-project.org/files/icu4c/$(ICU_VERSION_DOT)/icu4c-$(ICU_VERSION)-src.tgz
rm -rf tmp/icu/

tmp/icu/: icu4c-$(ICU_VERSION)-src.tgz
tar xvf

tmp/icu-$(ICU_VERSION)/local/: icu4c-$(ICU_VERSION)-src.tgz
rm -rf tmp/icu/
mkdir -p tmp
cd tmp && tar xf ../icu4c-$(ICU_VERSION)-src.tgz
cd tmp/icu/source && \
./configure --prefix=$$PWD/../../icu-$(ICU_VERSION)/local
cd tmp/icu/source && $(MAKE) $(MAKEFLAGS)
cd tmp/icu/source && $(MAKE) $(MAKEFLAGS) install

update-nfkc: tmp/icu-$(ICU_VERSION)/local/
ICU_HOME=$$PWD/tmp/icu-$(ICU_VERSION)/local \
$(RUBY) nfkc.rb
20 changes: 16 additions & 4 deletions lib/nfkc.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# Copyright(C) 2010-2016 Brazil
# Copyright(C) 2010-2018 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -840,8 +840,20 @@ def create_compose_map(decompose_map)
end
}

STDERR.puts('compiling icudump')
system('cc -Wall -O3 -o icudump -I/tmp/local/include -L/tmp/local/lib icudump.c -licuuc -licui18n')
icu_home = ENV["ICU_HOME"] || "/tmp/local"
STDERR.puts("compiling icudump on #{icu_home}")
system("cc",
"-Wall",
"-O3",
"-o", "icudump",
"-I#{icu_home}/include",
"-L#{icu_home}/lib",
"icudump.c",
"-licuuc",
"-licui18n",
"-licudata") or exit(false)

ENV["LD_LIBRARY_PATH"] = "#{icu_home}/lib:#{ENV["LD_LIBRARY_PATH"]}"

STDERR.puts('getting Unicode version')
unicode_version = `./icudump --version`.strip.gsub(".", "")
Expand All @@ -859,7 +871,7 @@ def create_compose_map(decompose_map)
output.puts(<<-HEADER)
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2010-2016 Brazil
Copyright(C) #{Time.now.year} Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand Down

0 comments on commit 615cacd

Please sign in to comment.