Skip to content

Commit

Permalink
add rpm support in Makefile.am
Browse files Browse the repository at this point in the history
  • Loading branch information
yhfudev committed Jan 18, 2015
1 parent 3c5d9b9 commit 459784a
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 53 deletions.
66 changes: 66 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -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/@[email protected] ${RPMBUILDTOPDIR}/SOURCES/ ${RPMBUILDTOPDIR}/SPECS/
$(RM) ${RPMBUILDTOPDIR}/SOURCES/$(distdir).tar.gz
$(RM) ${RPMBUILDTOPDIR}/SPECS/@[email protected]
$(LN_S) $(srcdir)/$(distdir).tar.gz ${RPMBUILDTOPDIR}/SOURCES/
$(LN_S) $(srcdir)/rpm/@[email protected] ${RPMBUILDTOPDIR}/SPECS/
rpmbuild -ba ${RPMBUILDTOPDIR}/SPECS/@[email protected]

# $(shell git log v2.1.0...v2.1.1 --pretty=format:'<li> <a href="http://github.com/yhfudev/cpp-libucd/commit/%H">view commit &bull;</a> %s</li> ' --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
6 changes: 4 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

9 changes: 5 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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])
Expand Down Expand Up @@ -144,6 +144,7 @@ AC_OUTPUT(Makefile
src/Makefile
pkgconfig/Makefile
pkgconfig/libucd.pc
rpm/libucd.spec
utils/Makefile
)
AC_OUTPUT
1 change: 1 addition & 0 deletions rpm/pkgrpm-cpp-libucd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
85 changes: 57 additions & 28 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,44 +1,73 @@

# 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

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/

Expand Down
3 changes: 2 additions & 1 deletion src/nsCodingStateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define nsCodingStateMachine_h__

#include "nsPkgInt.h"
#include "nsDebug.h"

typedef enum {
eStart = 0,
Expand Down Expand Up @@ -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];
}
Expand Down
1 change: 1 addition & 0 deletions src/nscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define __NS_FAKE_CORE_H

#include <stdint.h>
#include <stddef.h>

typedef bool PRBool;
typedef int32_t PRInt32;
Expand Down
23 changes: 5 additions & 18 deletions utils/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

#noinst_PROGRAMS=ucd

noinst_HEADERS = \
getline.h \
i18n.h \
$(NULL)

bin_PROGRAMS=ucd

ucd_SOURCES= \
Expand Down Expand Up @@ -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)

0 comments on commit 459784a

Please sign in to comment.