diff --git a/Makefile.am b/Makefile.am index b599859..66e0878 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,67 @@ SUBDIRS=src pkgconfig utils +DISTCLEANFILES = + +EXTRA_DIST=autogen.sh autoclean.sh ChangeLog + +CLEANFILES = *~ *.bz2 *.tar.gz *.log + +#dist_doc_DATA = LICENSE +DISTCLEANFILES += *~ *.bz2 *.tar.gz *.log aclocal.m4 + +# define rpm build root +RPMBUILDTOPDIR = $(shell unset RPMBUILDTOPDIR; if [ -f ${HOME}/.rpmmacros ]; then export RPMBUILDTOPDIR=`grep _topdir ${HOME}/.rpmmacros|awk '{print $$2}'`; else export RPMBUILDTOPDIR=/usr/src/redhat; fi; echo $${RPMBUILDTOPDIR};) + +.PHONY: rpm + +#${RPMBUILDTOPDIR}/rpmbuild/SOURCES/: +# echo TEST: rpmdev-setuptree $@ +# $(shell echo "%_topdir ${HOME}/rpmbuild/" > ${HOME}/.rpmmacros) + +rpm: dist rpm/@PACKAGE@.spec ${RPMBUILDTOPDIR}/SOURCES/ ${RPMBUILDTOPDIR}/SPECS/ + $(RM) ${RPMBUILDTOPDIR}/SOURCES/$(distdir).tar.gz + $(RM) ${RPMBUILDTOPDIR}/SPECS/@PACKAGE@.spec + $(LN_S) $(srcdir)/$(distdir).tar.gz ${RPMBUILDTOPDIR}/SOURCES/ + $(LN_S) $(srcdir)/rpm/@PACKAGE@.spec ${RPMBUILDTOPDIR}/SPECS/ + rpmbuild -ba ${RPMBUILDTOPDIR}/SPECS/@PACKAGE@.spec + +# $(shell git log v2.1.0...v2.1.1 --pretty=format:'
  • view commit • %s
  • ' --reverse | grep "#changelog" > ChangeLog.html) +# git log --graph --pretty=format:'[%h] %cI %an: %s' --no-merges --abbrev-commit --date=iso +#git log --no-merges --date-order --date=short | \ +# sed -e '/^commit.*$/d' | \ +# awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \ +# sed -e 's/^Author: //g' | \ +# sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \ +# sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' +ChangeLog: + if test -d $(srcdir)/.git; then \ + if test -f $(srcdir)/.last-cl-gen; then \ + git log --no-merges --date-order --date=short \ + $$(cat $(srcdir)/.last-cl-gen).. \ + | sed -e '/^commit.*$$/d' \ + | awk '/^Author/ {sub(/\\$$/,""); getline t; print $$0 t; next}; 1' \ + | sed -e 's/^Author: //g' \ + | sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' \ + | sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' \ + > ChangeLog.tmp; \ + else \ + git log --no-merges --date-order --date=short \ + | sed -e '/^commit.*$$/d' \ + | awk '/^Author/ {sub(/\\$$/,""); getline t; print $$0 t; next}; 1' \ + | sed -e 's/^Author: //g' \ + | sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' \ + | sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' \ + > ChangeLog.tmp; \ + fi; \ + touch ChangeLog \ + && git rev-list -n 1 HEAD >.last-cl-gen.tmp \ + && (echo; cat $(srcdir)/ChangeLog) >>ChangeLog.tmp \ + && mv -f ChangeLog.tmp $(srcdir)/ChangeLog \ + && mv -f .last-cl-gen.tmp $(srcdir)/.last-cl-gen \ + && rm -f ChangeLog.tmp; \ + fi + if test -d $(srcdir)/.hg; then \ + hg log --template changelog > ChangeLog; \ + touch $(srcdir)/.last-cl-gen; \ + fi + +EXTRA_DIST += .last-cl-gen diff --git a/autogen.sh b/autogen.sh index 0f42068..9462236 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,7 +13,7 @@ rm -f missing rm -f depcomp -touch README NEWS AUTHORS ChangeLog config.h.in +touch README NEWS AUTHORS LICENSE config.h.in ################# #autoscan @@ -24,6 +24,8 @@ automake -a -c autoconf ./configure --enable-static --enable-shared --enable-debug --prefix=`pwd`/aaa --disable-icu -make distclean +make clean +make ChangeLog #make +#make distclean diff --git a/configure.ac b/configure.ac index 812d77e..6a59466 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.61) -AC_INIT(libchsetdet, 1.0, BUG-REPORT-ADDRESS) +AC_PREREQ(2.59) +AC_INIT(libucd, 1.0.0, https://github.com/yhfudev/cpp-libucd.git) AC_CONFIG_SRCDIR([utils/ucd.c]) AC_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE(-Wall subdir-objects) +AM_INIT_AUTOMAKE(-Wall subdir-objects foreign color-tests dist-bzip2 parallel-tests) #magic for conditional check in Makefile: MK=''; AC_SUBST(MK) @@ -16,7 +16,7 @@ AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET -AM_PROG_AR +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # Checks for libraries. LT_INIT([shared static]) @@ -144,6 +144,7 @@ AC_OUTPUT(Makefile src/Makefile pkgconfig/Makefile pkgconfig/libucd.pc + rpm/libucd.spec utils/Makefile ) AC_OUTPUT diff --git a/rpm/pkgrpm-cpp-libucd.sh b/rpm/pkgrpm-cpp-libucd.sh index 0a7166a..b127d19 100755 --- a/rpm/pkgrpm-cpp-libucd.sh +++ b/rpm/pkgrpm-cpp-libucd.sh @@ -16,6 +16,7 @@ sed -i "s|%global shortcommit .*$|%global shortcommit %(c=%{commit}; echo \${c:0 sed -i "s|Source0:.*$|Source0: %{shortname}-%{shortcommit}.tar.gz|" ${FN_RPMSPEC} sed -i "s|%setup .*$|%setup -qn %{shortname}-%{shortcommit}|" ${FN_RPMSPEC} sed -i "s|Release:.*$|Release: 1.git%{shortcommit}%{?dist}|" ${FN_RPMSPEC} +sed -i "s|Version:.*$|Version: 1.0.0|" ${FN_RPMSPEC} RPMNAME=$(grep Name: ${FN_RPMSPEC} | awk '{print $2}') FILELIST=$(grep "Source[0-9]*:" "${FN_RPMSPEC}" | awk '{print $2}' | sed -e "s|%{name}|${RPMNAME}|g" | sed -e "s|%{shortname}|${SHORTNAME}|g" | sed -e "s|%{shortcommit}|${SHORTCOMMIT}|g" | sed -e "s|%{shortgit}|${SHORTCOMMIT}|g") diff --git a/src/Makefile.am b/src/Makefile.am index f855a06..6efbaa4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,39 @@ # public headers -# it will be moved to include/Makefile.am include_HEADERS = \ $(top_srcdir)/include/libucd.h \ $(NULL) +noinst_HEADERS = \ + CharDistribution.h \ + nsCodingStateMachine.h \ + nsGB2312Prober.h \ + nsSBCSGroupProber.h \ + JpCntx.h \ + nsEUCJPProber.h \ + nsHebrewProber.h \ + nsSBCharSetProber.h \ + nsEUCKRProber.h \ + nsLatin1Prober.h \ + nsSJISProber.h \ + nsBig5Prober.h \ + nsEUCTWProber.h \ + nsMBCSGroupProber.h \ + nsUTF8Prober.h \ + nsCharSetProber.h \ + nsEscCharsetProber.h \ + nsPkgInt.h \ + nsUniversalDetector.h \ + nsDebug.h \ + prmem.h \ + nscore.h \ + Big5Freq.tab \ + EUCKRFreq.tab \ + EUCTWFreq.tab \ + GB2312Freq.tab \ + JISFreq.tab \ + $(NULL) + #EXTRA_DIST = libucd.pc.in #pkgconfigdir = $(libdir)/pkgconfig #pkgconfig_DATA = libucd.pc @@ -12,33 +41,33 @@ include_HEADERS = \ lib_LTLIBRARIES=libucd.la libucd_la_SOURCES = \ - ucdapi.cpp \ - CharDistribution.cpp \ - JpCntx.cpp \ - LangBulgarianModel.cpp \ - LangCyrillicModel.cpp \ - LangGreekModel.cpp \ - LangHebrewModel.cpp \ - LangHungarianModel.cpp \ - LangThaiModel.cpp \ - nsBig5Prober.cpp \ - nsCharSetProber.cpp \ - nsEUCJPProber.cpp \ - nsEUCKRProber.cpp \ - nsEUCTWProber.cpp \ - nsEscCharsetProber.cpp \ - nsEscSM.cpp \ - nsGB2312Prober.cpp \ - nsHebrewProber.cpp \ - nsLatin1Prober.cpp \ - nsMBCSGroupProber.cpp \ - nsMBCSSM.cpp \ - nsSBCSGroupProber.cpp \ - nsSBCharSetProber.cpp \ - nsSJISProber.cpp \ - nsUTF8Prober.cpp \ - nsUniversalDetector.cpp \ - $(NULL) + ucdapi.cpp \ + CharDistribution.cpp \ + JpCntx.cpp \ + LangBulgarianModel.cpp \ + LangCyrillicModel.cpp \ + LangGreekModel.cpp \ + LangHebrewModel.cpp \ + LangHungarianModel.cpp \ + LangThaiModel.cpp \ + nsBig5Prober.cpp \ + nsCharSetProber.cpp \ + nsEUCJPProber.cpp \ + nsEUCKRProber.cpp \ + nsEUCTWProber.cpp \ + nsEscCharsetProber.cpp \ + nsEscSM.cpp \ + nsGB2312Prober.cpp \ + nsHebrewProber.cpp \ + nsLatin1Prober.cpp \ + nsMBCSGroupProber.cpp \ + nsMBCSSM.cpp \ + nsSBCSGroupProber.cpp \ + nsSBCharSetProber.cpp \ + nsSJISProber.cpp \ + nsUTF8Prober.cpp \ + nsUniversalDetector.cpp \ + $(NULL) libucd_la_CPPFLAGS = -I$(top_srcdir)/src/ -I$(top_srcdir)/include/ diff --git a/src/nsCodingStateMachine.h b/src/nsCodingStateMachine.h index dc9b1fc..4f779e3 100644 --- a/src/nsCodingStateMachine.h +++ b/src/nsCodingStateMachine.h @@ -8,6 +8,7 @@ #define nsCodingStateMachine_h__ #include "nsPkgInt.h" +#include "nsDebug.h" typedef enum { eStart = 0, @@ -46,7 +47,7 @@ class nsCodingStateMachine { { mCurrentBytePos = 0; #ifdef DEBUG - assert (byteCls < mModel->szCharLenTable); + NS_ASSERTION (byteCls < mModel->szCharLenTable, "char tab overflow!!"); #endif mCurrentCharLen = mModel->charLenTable[byteCls]; } diff --git a/src/nscore.h b/src/nscore.h index 160bdf8..9510e72 100644 --- a/src/nscore.h +++ b/src/nscore.h @@ -11,6 +11,7 @@ #define __NS_FAKE_CORE_H #include +#include typedef bool PRBool; typedef int32_t PRInt32; diff --git a/utils/Makefile.am b/utils/Makefile.am index 59cc62b..da66be0 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,6 +1,11 @@ #noinst_PROGRAMS=ucd +noinst_HEADERS = \ + getline.h \ + i18n.h \ + $(NULL) + bin_PROGRAMS=ucd ucd_SOURCES= \ @@ -91,21 +96,3 @@ else AM_CPPFLAGS+=-O3 -Wall endif -#AM_CPPFLAGS+=-fpermissive - - -EXT_FLAGS= -@MK@GITNUMTMP=$(shell cd "$(top_srcdir)"; A=$$(git show | head -n 1 | awk '{print $$2}'); echo $${A:0:7}; cd - > /dev/null ) -#@MK@SVNNUMTMP=$(shell cd "$(top_srcdir)"; LC_ALL=C svn info | grep -i Revision | awk '{print $$2}'; cd - > /dev/null ) -#@MK@ifeq ($(SVNNUMTMP),) -#EXT_FLAGS+= -DSVN_VERSION='"${GITNUMTMP}"' -#@MK@else -#EXT_FLAGS+= -DSVN_VERSION='"${SVNNUMTMP}"' -#@MK@endif -@MK@ifeq ($(GITNUMTMP),) -@MK@else -EXT_FLAGS+= -DSVN_VERSION='"${GITNUMTMP}"' -@MK@endif -DEFS+=$(EXT_FLAGS) - -#AM_CPPFLAGS+=$(EXT_FLAGS)