Fake.
Split languages into separate packages. Include a script for choosing the default language.
This commit is contained in:
parent
f9d998f1cf
commit
e947e788c9
@ -1,86 +1,90 @@
|
||||
# $OpenBSD: Makefile,v 1.17 2000/04/09 17:38:27 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.18 2000/06/23 03:06:34 jasoni Exp $
|
||||
# Original from: Ejovi Nuwere <ejovi@ejovi.net>
|
||||
|
||||
FRENCH_DICT= francais-IREQ-1.4
|
||||
GERMAN_DICT= hk2-deutsch
|
||||
|
||||
DISTNAME= ispell-3.1.20
|
||||
CATEGORIES= textproc
|
||||
NEED_VERSION= 1.195
|
||||
FAKE=No
|
||||
NEED_VERSION= 1.270
|
||||
MASTER_SITES= ftp://ftp.cs.ucla.edu/pub/ispell-3.1/
|
||||
MASTER_SITES0= ftp://ftp.robot.ireq.ca/pub/ispell/
|
||||
MASTER_SITES1= ftp://ftp.informatik.uni-kiel.de/pub/kiel/dicts/
|
||||
MASTER_SITES2= ftp://ftp.kiarchive.ru/pub/unix/text/ispell/
|
||||
SUPDISTFILES= ${FRENCH_DICT}.tar.gz:0 ${GERMAN_DICT}.tar.gz:1
|
||||
FRENCH_DICT= francais-IREQ-1.4
|
||||
GERMAN_DICT= hk2-deutsch
|
||||
DISTFILES= ${DISTNAME}.tar.gz ${FRENCH_DICT}.tar.gz:0 ${GERMAN_DICT}.tar.gz:1
|
||||
EXTRACT_ONLY= ${DISTNAME}.tar.gz ${GERMAN_DICT}.tar.gz
|
||||
|
||||
PATCHFILES= ispell-html-mode.patch:2
|
||||
|
||||
MAINTAINER= ports@openbsd.org
|
||||
|
||||
LICENSE_TYPE= BSD
|
||||
PERMIT_PACKAGE_CDROM= YES
|
||||
PERMIT_PACKAGE_FTP= YES
|
||||
PERMIT_DISTFILES_CDROM= YES
|
||||
PERMIT_DISTFILES_FTP= YES
|
||||
MULTI_PACKAGES= -french -german
|
||||
|
||||
MAKE_FLAGS= TMPDIR=${WRKDIR}
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
WRKDIST= ${WRKDIR}/ispell-3.1
|
||||
MAKE_FLAGS= TMPDIR=${WRKDIR}
|
||||
|
||||
pre-fetch pre-build pre-install:
|
||||
.if !defined(NO_WARNINGS)
|
||||
.if !defined(ISPELL_FR) && !defined(ISPELL_DE)
|
||||
@echo ''
|
||||
@echo '******************************************************'
|
||||
@echo '* Note that you can build a french/english or a *'
|
||||
@echo '* german/english version by setting the shell *'
|
||||
@echo '* variable ISPELL_FR or ISPELL_DE to yes, ie. *'
|
||||
@echo '* "make ISPELL_FR=yes" or "make ISPELL_DE=yes" *'
|
||||
@echo '******************************************************'
|
||||
@echo ''
|
||||
.elif defined(ISPELL_FR) && ${ISPELL_FR:U} == YES
|
||||
EXTRA_DICT= ${FRENCH_DICT}.tar.gz
|
||||
DISTFILES= ${DISTNAME}.tar.gz ${EXTRA_DICT}:0
|
||||
PLIST= ${PKGDIR}/PLIST.french
|
||||
.elif defined(ISPELL_DE) && ${ISPELL_DE:U} == YES
|
||||
EXTRA_DICT= ${GERMAN_DICT}.tar.gz
|
||||
DISTFILES= ${DISTNAME}.tar.gz ${EXTRA_DICT}:1
|
||||
PLIST= ${PKGDIR}/PLIST.german
|
||||
.endif
|
||||
.endif
|
||||
|
||||
pre-extract:
|
||||
.if !defined(LANG)
|
||||
@echo ''
|
||||
@echo '******************************************************'
|
||||
@echo '* Note that you can build a british version by *'
|
||||
@echo '* typing "make british" following a "make clean" *'
|
||||
@echo '******************************************************'
|
||||
@echo ''
|
||||
.endif
|
||||
|
||||
pre-configure:
|
||||
.if defined(EXTRA_DICT)
|
||||
@echo ${EXTRA_DICT} > ${WRKDIR}/extra_dict
|
||||
.endif
|
||||
post-extract:
|
||||
@mkdir ${WRKDIST}/languages/francais-IREQ
|
||||
@(cd ${WRKDIST}/languages/francais-IREQ; tar zxf ${DISTDIR}/${FRENCH_DICT}.tar.gz)
|
||||
|
||||
post-configure:
|
||||
@echo "#define CFLAGS \"${CFLAGS}\"" >> ${WRKSRC}/local.h
|
||||
|
||||
british:
|
||||
@echo "Okay, making a british version of ispell...."
|
||||
@make ${.MAKEFLAGS} LANG=british
|
||||
post-build:
|
||||
@sed "s%/usr/local%${PREFIX}%g" ${SCRIPTDIR}/ispell-config > \
|
||||
${WRKDIST}/ispell-config
|
||||
|
||||
french:
|
||||
@echo "Okay, making a french/english version of ispell...."
|
||||
@make ${.MAKEFLAGS} ISPELL_FR=Yes
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/ispell ${PREFIX}/bin/ispell
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/buildhash ${PREFIX}/bin/buildhash
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/sq ${PREFIX}/bin/sq
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/tryaffix ${PREFIX}/bin/tryaffix
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/ijoin ${PREFIX}/bin/ijoin
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/findaffix ${PREFIX}/bin/findaffix
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/munchlist ${PREFIX}/bin/munchlist
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/icombine ${PREFIX}/bin/icombine
|
||||
${INSTALL_PROGRAM} ${WRKDIST}/unsq ${PREFIX}/bin/unsq
|
||||
${INSTALL_SCRIPT} ${WRKDIST}/ispell-config ${PREFIX}/bin/ispell-config
|
||||
${INSTALL_DATA} ${WRKDIST}/ispell.info ${PREFIX}/info/ispell.info
|
||||
|
||||
german:
|
||||
@echo "Okay, making a german/english version of ispell...."
|
||||
@make ${.MAKEFLAGS} ISPELL_DE=Yes
|
||||
${INSTALL_MAN} ${WRKDIST}/ispell.1 ${PREFIX}/man/man1/ispell.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/sq.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/buildhash.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/munchlist.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/findaffix.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/tryaffix.1
|
||||
ln -s ispell.1 ${PREFIX}/man/man1/unsq.1
|
||||
${INSTALL_MAN} ${WRKDIST}/ispell.4 ${PREFIX}/man/man4/ispell.4
|
||||
ln -s ispell.4 ${PREFIX}/man/man4/english.4
|
||||
|
||||
post-install:
|
||||
@install-info ${PREFIX}/info/ispell.info ${PREFIX}/info/dir
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/lib/ispell
|
||||
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/english/english.aff \
|
||||
${PREFIX}/lib/ispell/american.aff
|
||||
ln -s american.aff ${PREFIX}/lib/ispell/british.aff
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/american/americanmed+.hash \
|
||||
${PREFIX}/lib/ispell/americanmed+.hash
|
||||
ln -s americanmed+.hash ${PREFIX}/lib/ispell/american.hash
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/british/britishxlg.hash \
|
||||
${PREFIX}/lib/ispell/britishxlg.hash
|
||||
ln -s britishxlg.hash ${PREFIX}/lib/ispell/british.hash
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/deutsch/deutsch.aff \
|
||||
${PREFIX}/lib/ispell/deutsch.aff
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/deutsch/deutsch.hash \
|
||||
${PREFIX}/lib/ispell/deutsch.hash
|
||||
${INSTALL_DATA} ${WRKDIST}//languages/francais-IREQ/francais.aff \
|
||||
${PREFIX}/lib/ispell/francais.aff
|
||||
${INSTALL_DATA} ${WRKDIST}/languages/francais-IREQ/francais.hash \
|
||||
${PREFIX}/lib/ispell/francais.hash
|
||||
ln -s american.aff ${PREFIX}/lib/ispell/default.aff
|
||||
ln -s american.hash ${PREFIX}/lib/ispell/default.hash
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
||||
.if defined(SUBPACKAGE)
|
||||
PKGNAME=ispell${SUBPACKAGE}-3.1.20
|
||||
.endif
|
||||
|
17
textproc/ispell/patches/patch-ah
Normal file
17
textproc/ispell/patches/patch-ah
Normal file
@ -0,0 +1,17 @@
|
||||
--- local.h.samp.orig Fri Jun 16 02:38:42 2000
|
||||
+++ local.h.samp Fri Jun 16 02:41:19 2000
|
||||
@@ -87,7 +87,7 @@
|
||||
* Important directory paths
|
||||
*/
|
||||
#define BINDIR "/usr/local/bin"
|
||||
-#define LIBDIR "/usr/local/lib"
|
||||
+#define LIBDIR "/usr/local/lib/ispell"
|
||||
#define ELISPDIR "/usr/local/lib/emacs/site-lisp"
|
||||
#define TEXINFODIR "/usr/local/info"
|
||||
#define MAN1DIR "/usr/local/man/man1"
|
||||
@@ -96,3 +96,5 @@
|
||||
/*
|
||||
* Place any locally-required #include statements here
|
||||
*/
|
||||
+#define DEFHASH "default.hash"
|
||||
+#define DEFLANG "default.aff"
|
1
textproc/ispell/pkg/COMMENT-french
Normal file
1
textproc/ispell/pkg/COMMENT-french
Normal file
@ -0,0 +1 @@
|
||||
ispell dictionnary for French words
|
1
textproc/ispell/pkg/COMMENT-german
Normal file
1
textproc/ispell/pkg/COMMENT-german
Normal file
@ -0,0 +1 @@
|
||||
ispell dictionary for German words
|
6
textproc/ispell/pkg/DESCR-french
Normal file
6
textproc/ispell/pkg/DESCR-french
Normal file
@ -0,0 +1,6 @@
|
||||
Ispell is a fast screen-oriented spelling checker that shows you your
|
||||
errors in the context of the original file, and suggests possible
|
||||
corrections when it can figure them out. Compared to UNIX spell, it
|
||||
is faster and much easier to use. This package add a French
|
||||
dictionary that can be used by ispell.
|
||||
|
6
textproc/ispell/pkg/DESCR-german
Normal file
6
textproc/ispell/pkg/DESCR-german
Normal file
@ -0,0 +1,6 @@
|
||||
Ispell is a fast screen-oriented spelling checker that shows you your
|
||||
errors in the context of the original file, and suggests possible
|
||||
corrections when it can figure them out. Compared to UNIX spell, it
|
||||
is faster and much easier to use. This package adds a German
|
||||
dictionary that can be used by ispell.
|
||||
|
49
textproc/ispell/pkg/INSTALL
Normal file
49
textproc/ispell/pkg/INSTALL
Normal file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
# $OpenBSD: INSTALL,v 1.1 2000/06/23 03:06:34 jasoni Exp $
|
||||
#
|
||||
# Pre/post-installation setup of bash
|
||||
|
||||
# Function: tell the user what s/he needs to do to use the port just installed
|
||||
#
|
||||
do_notice()
|
||||
{
|
||||
echo
|
||||
echo "+---------------"
|
||||
echo "| This package has installed the American and British dictionaries."
|
||||
echo "| Dictionary packages for other languages are available."
|
||||
echo "+---------------"
|
||||
echo
|
||||
}
|
||||
|
||||
# exit on errors, use a sane path and install prefix
|
||||
#
|
||||
set -e
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
PREFIX=${PKG_PREFIX:-/usr/local}
|
||||
|
||||
# verify proper execution
|
||||
#
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify/process the command
|
||||
#
|
||||
case $2 in
|
||||
PRE-INSTALL)
|
||||
: nothing to pre-install for this port
|
||||
;;
|
||||
POST-INSTALL)
|
||||
do_notice
|
||||
echo "invoking ${PREFIX}/bin/ispell-config"
|
||||
${PREFIX}/bin/ispell-config
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@ -1,3 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.7 2000/06/23 03:06:35 jasoni Exp $
|
||||
bin/ispell
|
||||
bin/buildhash
|
||||
bin/sq
|
||||
@ -7,13 +8,18 @@ bin/findaffix
|
||||
bin/munchlist
|
||||
bin/icombine
|
||||
bin/unsq
|
||||
bin/ispell-config
|
||||
@unexec install-info --delete %D/info/ispell.info %D/info/dir
|
||||
info/ispell.info
|
||||
@exec install-info %D/info/ispell.info %D/info/dir
|
||||
lib/americanmed+.hash
|
||||
lib/english.aff
|
||||
lib/american.hash
|
||||
lib/english.hash
|
||||
lib/ispell/default.aff
|
||||
lib/ispell/default.hash
|
||||
lib/ispell/americanmed+.hash
|
||||
lib/ispell/american.hash
|
||||
lib/ispell/american.aff
|
||||
lib/ispell/britishxlg.hash
|
||||
lib/ispell/british.hash
|
||||
lib/ispell/british.aff
|
||||
man/man1/ispell.1
|
||||
man/man1/sq.1
|
||||
man/man1/buildhash.1
|
||||
@ -23,3 +29,4 @@ man/man1/tryaffix.1
|
||||
man/man1/unsq.1
|
||||
man/man4/ispell.4
|
||||
man/man4/english.4
|
||||
@dirrm lib/ispell
|
||||
|
6
textproc/ispell/pkg/PLIST-french
Normal file
6
textproc/ispell/pkg/PLIST-french
Normal file
@ -0,0 +1,6 @@
|
||||
@comment $OpenBSD: PLIST-french,v 1.1 2000/06/23 03:06:35 jasoni Exp $
|
||||
@pkgdep ispell-3.1.20
|
||||
lib/ispell/francais.aff
|
||||
lib/ispell/francais.hash
|
||||
@exec echo 'invoking %D/bin/ispell-config'
|
||||
@exec %D/bin/ispell-config
|
6
textproc/ispell/pkg/PLIST-german
Normal file
6
textproc/ispell/pkg/PLIST-german
Normal file
@ -0,0 +1,6 @@
|
||||
@comment $OpenBSD: PLIST-german,v 1.1 2000/06/23 03:06:35 jasoni Exp $
|
||||
@pkgdep ispell-3.1.20
|
||||
lib/ispell/deutsch.aff
|
||||
lib/ispell/deutsch.hash
|
||||
@exec echo 'invoking %D/bin/ispell-config'
|
||||
@exec %D/bin/ispell-config
|
@ -1,27 +0,0 @@
|
||||
bin/ispell
|
||||
bin/buildhash
|
||||
bin/sq
|
||||
bin/tryaffix
|
||||
bin/ijoin
|
||||
bin/findaffix
|
||||
bin/munchlist
|
||||
bin/icombine
|
||||
bin/unsq
|
||||
@unexec install-info --delete %D/info/ispell.info %D/info/dir
|
||||
info/ispell.info
|
||||
@exec install-info %D/info/ispell.info %D/info/dir
|
||||
lib/americanmed+.hash
|
||||
lib/english.aff
|
||||
lib/american.hash
|
||||
lib/english.hash
|
||||
lib/francais.hash
|
||||
lib/francais.aff
|
||||
man/man1/ispell.1
|
||||
man/man1/sq.1
|
||||
man/man1/buildhash.1
|
||||
man/man1/munchlist.1
|
||||
man/man1/findaffix.1
|
||||
man/man1/tryaffix.1
|
||||
man/man1/unsq.1
|
||||
man/man4/ispell.4
|
||||
man/man4/english.4
|
@ -1,27 +0,0 @@
|
||||
bin/ispell
|
||||
bin/buildhash
|
||||
bin/sq
|
||||
bin/tryaffix
|
||||
bin/ijoin
|
||||
bin/findaffix
|
||||
bin/munchlist
|
||||
bin/icombine
|
||||
bin/unsq
|
||||
@unexec install-info --delete %D/info/ispell.info %D/info/dir
|
||||
info/ispell.info
|
||||
@exec install-info %D/info/ispell.info %D/info/dir
|
||||
lib/americanmed+.hash
|
||||
lib/english.aff
|
||||
lib/american.hash
|
||||
lib/english.hash
|
||||
lib/deutsch.hash
|
||||
lib/deutsch.aff
|
||||
man/man1/ispell.1
|
||||
man/man1/sq.1
|
||||
man/man1/buildhash.1
|
||||
man/man1/munchlist.1
|
||||
man/man1/findaffix.1
|
||||
man/man1/tryaffix.1
|
||||
man/man1/unsq.1
|
||||
man/man4/ispell.4
|
||||
man/man4/english.4
|
71
textproc/ispell/scripts/configure
vendored
71
textproc/ispell/scripts/configure
vendored
@ -10,50 +10,39 @@ if [ ! -f /usr/share/dict/words ]; then
|
||||
fi
|
||||
cd $WRKSRC || exit 1;
|
||||
|
||||
if [ -f $WRKDIR/extra_dict ]; then
|
||||
extra_dict=`cat $WRKDIR/extra_dict`;
|
||||
case $extra_dict in
|
||||
francais-IREQ*)
|
||||
mkdir -p $WRKSRC/languages/francais-IREQ
|
||||
LOCAL=' {francais-IREQ}'
|
||||
for i in $WRKDIR/[A-Za-z]*; do
|
||||
if [ -f $i ]; then cp $i $WRKSRC/languages/francais-IREQ/; fi
|
||||
done
|
||||
(echo RM=rm -f; echo LIBDIR=$PREFIX/lib; echo HASH=../../buildhash) \
|
||||
>> $WRKSRC/languages/francais-IREQ/Makefile
|
||||
;;
|
||||
hk2-deutsch*)
|
||||
OPT="worte.txt verben.txt adjektive.txt klein.txt imperat.txt"
|
||||
OPT="$OPT abkuerz.txt vornamen.txt geographie.txt latein.txt"
|
||||
OPT="$OPT informatik.txt infoabk.txt elektronik.txt alphabeta.txt"
|
||||
OPT="$OPT roemisch.txt orgabk.txt marken.txt worte2.txt zusammen.txt"
|
||||
OPT="$OPT technik.txt compeng.txt geogra2.txt vornam2.txt namen.txt"
|
||||
LOCAL=" {deutsch,DICTOPTIONS=$OPT}"
|
||||
for i in $WRKDIR/*.txt $WRKDIR/*.aff; do
|
||||
if [ -f $i ]; then cp $i $WRKSRC/languages/deutsch/; fi
|
||||
done
|
||||
M=$WRKSRC/languages/deutsch/Makefile
|
||||
cp $M $M.orig
|
||||
sed -e '/7bit/s/^/##/' < $M.orig > $M
|
||||
;;
|
||||
*)
|
||||
echo "I don't now how to configure ispell with $extra_dict"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Setup french dictionary
|
||||
LOCAL=' {francais-IREQ}'
|
||||
(echo RM=rm -f; echo LIBDIR=$PREFIX/lib; echo HASH=../../buildhash) \
|
||||
>> $WRKSRC/languages/francais-IREQ/Makefile
|
||||
|
||||
# Setup german dictionary
|
||||
OPT="worte.txt verben.txt adjektive.txt klein.txt imperat.txt"
|
||||
OPT="$OPT abkuerz.txt vornamen.txt geographie.txt latein.txt"
|
||||
OPT="$OPT informatik.txt infoabk.txt elektronik.txt alphabeta.txt"
|
||||
OPT="$OPT roemisch.txt orgabk.txt marken.txt worte2.txt zusammen.txt"
|
||||
OPT="$OPT technik.txt compeng.txt geogra2.txt vornam2.txt namen.txt"
|
||||
LOCAL="${LOCAL} {deutsch,DICTOPTIONS=$OPT}"
|
||||
for i in $WRKDIR/*.txt $WRKDIR/*.aff; do
|
||||
if [ -f $i ]; then cp $i $WRKSRC/languages/deutsch/; fi
|
||||
done
|
||||
M=$WRKSRC/languages/deutsch/Makefile
|
||||
cp $M $M.orig
|
||||
sed -e '/7bit/s/^/##/' < $M.orig > $M
|
||||
|
||||
sed -e s:/usr/local:$PREFIX: <local.h.samp >local.h || exit 1;
|
||||
echo "#undef NO8BIT" >> local.h
|
||||
case $LANG in
|
||||
british)
|
||||
echo "#define LANGUAGES \"{british,MASTERDICTS=british.xlg,HASHFILES=britishxlg.hash,EXTRADICT=}$LOCAL\"" >>local.h ||exit 1;
|
||||
echo '#define MASTERHASH "britishxlg.hash"' >> local.h
|
||||
break ;;
|
||||
*)
|
||||
echo "#define LANGUAGES \"{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/share/dict/words}$LOCAL\"" >>local.h ||exit 1;
|
||||
:;;
|
||||
esac
|
||||
#case $LANG in
|
||||
# british)
|
||||
# echo "#define LANGUAGES \"{british,MASTERDICTS=british.xlg,HASHFILES=britishxlg.hash,EXTRADICT=}$LOCAL\"" >>local.h ||exit 1;
|
||||
# echo '#define MASTERHASH "britishxlg.hash"' >> local.h
|
||||
# break ;;
|
||||
# *)
|
||||
# echo "#define LANGUAGES \"{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/share/dict/words}$LOCAL\"" >>local.h ||exit 1;
|
||||
# :;;
|
||||
#esac
|
||||
|
||||
echo "#define LANGUAGES \"{british,MASTERDICTS=british.xlg,HASHFILES=britishxlg.hash,EXTRADICT=} {american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/share/dict/words}$LOCAL\"" >> local.h || exit 1;
|
||||
echo '#define MASTERHASH "britishxlg.hash"' >> local.h
|
||||
|
||||
echo "#undef WORDS" >> local.h
|
||||
echo '#define WORDS "/usr/share/dict/words"' >> local.h
|
||||
|
93
textproc/ispell/scripts/ispell-config
Executable file
93
textproc/ispell/scripts/ispell-config
Executable file
@ -0,0 +1,93 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Script to change the default language for ispell.
|
||||
# Parts borrowed from a similar script for Debian Linux.
|
||||
#
|
||||
# By: Jason Ish <jasoni@openbsd.org>
|
||||
#
|
||||
|
||||
PREFIX=/usr/local
|
||||
DICT_DIR=/usr/local/lib/ispell
|
||||
|
||||
choose_default()
|
||||
{
|
||||
echo -n "Select the number of the new default dictionary [0] "
|
||||
read num
|
||||
selected_num=${num:-1}
|
||||
selected=`echo -e $dictionaries | grep "\[$selected_num\]" | awk '{print $2}'`
|
||||
|
||||
if [ -z $selected ]
|
||||
then
|
||||
echo -e "\nInvalid choice - try again!\n"
|
||||
choose_default
|
||||
fi
|
||||
}
|
||||
|
||||
# Do we have permission to change the default dictionary?
|
||||
if [ ! -w ${DICT_DIR} ]; then
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Sorry, but you do not have permission to change"
|
||||
echo "the default dictionary."
|
||||
echo "***"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
||||
# Get list of dictionaries.
|
||||
dictionaries=`ls ${DICT_DIR}/*.aff \
|
||||
| grep -v default \
|
||||
| sed "s%${DICT_DIR}/%%" \
|
||||
| sed "s%\.aff%%" \
|
||||
| awk '{printf ("\\\t[%d] %s\\\n", NR, $1)}'` 2> /dev/null
|
||||
if [ "x$dictionaries" == "x" ]; then
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "There are no languages present. Install at least one language and re-run."
|
||||
echo "***"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
||||
# Get current default dictionary.
|
||||
if [ -f ${DICT_DIR}/default.aff ]; then
|
||||
default_dict=`readlink ${DICT_DIR}/default.aff \
|
||||
| sed "s%\.aff%%" \
|
||||
| sed "s%.*/%%"`
|
||||
if [ -z $default_dict ]; then
|
||||
default_dict="None"
|
||||
fi
|
||||
else
|
||||
default_dict="None"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Current default dictionary: $default_dict"
|
||||
dictionaries="\t[0] Current\n"${dictionaries}
|
||||
echo -e $dictionaries
|
||||
|
||||
choose_default
|
||||
|
||||
# Set the default dictionary
|
||||
if [ $selected_num == 0 ]; then
|
||||
echo ""
|
||||
echo "Keeping the current dictionary."
|
||||
echo ""
|
||||
else
|
||||
if [ ! -e ${DICT_DIR}/$selected.aff ]; then
|
||||
echo "Error: $selected.aff does not exist."
|
||||
exit
|
||||
fi
|
||||
if [ ! -e ${DICT_DIR}/$selected.hash ]; then
|
||||
echo "Error: $selected.hash does not exist."
|
||||
exit
|
||||
fi
|
||||
rm -f ${DICT_DIR}/default.aff
|
||||
ln -s ./$selected.aff ${DICT_DIR}/default.aff
|
||||
rm -f ${DICT_DIR}/default.hash
|
||||
ln -s ./$selected.hash ${DICT_DIR}/default.hash
|
||||
|
||||
echo ""
|
||||
echo "The default dictionary is now: $selected"
|
||||
echo ""
|
||||
fi
|
Loading…
Reference in New Issue
Block a user