Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kou1okada/4037884 to your computer and use it in GitHub Desktop.
Save kou1okada/4037884 to your computer and use it in GitHub Desktop.
build hts-voice-nitech-jp-atr503-m001 package for cygwin
#!/usr/bin/env bash
#-----------------------------------------------------------------------------
PKGNAME=hts-voice-nitech-jp-atr503-m001
VERSION=1.05
SRCURL=http://downloads.sourceforge.net/open-jtalk/hts_voice_nitech_jp_atr503_m001-${VERSION}.tar.gz
SRCARC=${SRCURL##*/}
SRCDIR=${SRCARC%.tar.gz}
CONFIGUREOPT=""
REQUIRES=( )
HINT="\
@ $PKGNAME\n\
sdesc: \"HTS voice date of nithec-jp-atr503-m001\"\n\
ldesc: \"HTS voice data of nithec-jp-atr503-m001.\"\n\
category: Audio\n\
requires: cygwin\n\
version: $VERSION\n\
"
prebuild () {
mkdir -p $BUILDDIR/$SRCDIR
touch $BUILDDIR/$SRCDIR/extract
cat <<EOD > $BUILDDIR/$SRCDIR/configure
#!/bin/sh
EOD
chmod 755 $BUILDDIR/$SRCDIR/configure
cat <<EOD > $BUILDDIR/$SRCDIR/Makefile
.PHONY : install
all:
install:
tar zxvf ../$SRCARC
mkdir -p "\$(DESTDIR)/usr/share/hts-voice"
-rm "\$(DESTDIR)/usr/share/hts-voice/nitech-jp-atr503-m001"
mv $SRCDIR "\$(DESTDIR)/usr/share/hts-voice/nitech-jp-atr503-m001"
EOD
}
#-----------------------------------------------------------------------------
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