Skip to content

Instantly share code, notes, and snippets.

@kou1okada
Last active October 12, 2015 12:48
Show Gist options
  • Save kou1okada/4029380 to your computer and use it in GitHub Desktop.
Save kou1okada/4029380 to your computer and use it in GitHub Desktop.
Build Open JTalk package for cygwin
#!/usr/bin/env bash
#-----------------------------------------------------------------------------
PKGNAME=open-jtalk
VERSION=1.06
SRCURL=http://downloads.sourceforge.net/open-jtalk/open_jtalk-${VERSION}.tar.gz
SRCARC=${SRCURL##*/}
SRCDIR=${SRCARC%.tar.gz}
CONFIGUREOPT="--with-hts-engine-header-path=/usr/include --with-hts-engine-library-path=/usr/lib --with-charset=UTF-8"
REQUIRES=( /usr/include/HTS_engine.h )
HINT="\
@ $PKGNAME\n\
sdesc: \"Open JTalk. Japanese text-to-speech system.\"\n\
ldesc: \"Open JTalk. Japanese text-to-speech system.\"\n\
category: Audio\n\
requires: cygwin\n\
version: $VERSION\n\
"
prebuild () {
true # If you have something to do at prebuild phase, write it here.
}
#-----------------------------------------------------------------------------
BUILDDIR=$PKGNAME
PKGDIR=$PKGNAME
PKGFILE=$PKGNAME-$VERSION.tar.bz2
for i in "${REQUIRES[@]}"; do
if [ ! -e "$i" ]; then
echo "Error: $i is not found."
echo
exit
fi
done
mkdir -p $BUILDDIR $BUILDDIR/$PKGDIR
echo -e "$HINT" > $BUILDDIR/$PKGDIR/setup.hint
cat <<EOD > $BUILDDIR/Makefile
PKGNAME=$PKGNAME
SRCURL="$SRCURL"
SRCARC=$SRCARC
SRCDIR=$SRCDIR
PKGDIR=$PKGDIR
PKGFILE=\$(PKGDIR)/$PKGFILE
all: download \$(PKGFILE)
@echo =========================================
@echo "Following cygwin package files are built."
@ls -l \$(PKGFILE)
#patch:
# patch -d \$(SRCDIR) -p 1 < \$(PKGNAME).patch
# touch \$@
download: \$(SRCARC)
\$(SRCARC):
wget -c --content-disposition "\$(SRCURL)"
extract: \$(SRCDIR)/extract
\$(SRCDIR)/extract: \$(SRCARC)
ifeq (\$(patsubst %.tar.gz,.tar.gz,\$(SRCARC)),.tar.gz)
tar zxvf \$(SRCARC)
endif
ifeq (\$(suffix \$(SRCARC)),.tgz)
tar zxvf \$(SRCARC)
endif
ifeq (\$(suffix \$(SRCARC)),.zip)
unzip \$(SRCARC)
endif
touch \$@
\$(SRCDIR)/Makefile: extract
cd \$(SRCDIR) && ./configure --prefix=/usr $CONFIGUREOPT
build: \$(SRCDIR)/Makefile
cd \$(SRCDIR) && make DESTDIR="\`pwd\`/tmp" install
touch \$@
\$(PKGFILE): build
mkdir -p \$(PKGDIR)
cd \$(SRCDIR)/tmp && tar jcvf ../../\$(PKGFILE) *
buildclean:
-rm build patch extract
clean: buildclean
cd \$(SRCDIR) && make clean
distclean: buildclean
cd \$(SRCDIR) && make distclean
distcleanall: buildclean
-rm -r \$(SRCDIR) \$(PKGDIR)
EOD
prebuild
cd $BUILDDIR && make "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment