Testowałem działanie generowania domyślnej konfiguracji. Brakuje jakiś modułów. :(
git-svn-id: svn://atos.wmid.amu.edu.pl/utt@12 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
parent
b2647ded51
commit
d593c5e768
283
app/dist/common/utt_make_config.pl
vendored
283
app/dist/common/utt_make_config.pl
vendored
@ -1,141 +1,142 @@
|
|||||||
#!c:\usr\perl\bin\perl.exe
|
#!/usr/bin/perl
|
||||||
|
#c:\usr\perl\bin\perl.exe
|
||||||
use Cwd 'abs_path';
|
|
||||||
use File::Basename;
|
use Cwd 'abs_path';
|
||||||
use File::HomeDir;
|
use File::Basename;
|
||||||
use File::Spec::Functions;
|
use File::HomeDir;
|
||||||
use POSIX;
|
use File::Spec::Functions;
|
||||||
|
use POSIX;
|
||||||
my $sys_home = catdir(dirname(abs_path($0)), "..");
|
|
||||||
my $usr_home = catdir(home(), '.utt');
|
my $sys_home = catdir(dirname(abs_path($0)), "..");
|
||||||
|
my $usr_home = catdir(home(), '.utt');
|
||||||
prepareUttUsrHome($usr_home);
|
|
||||||
conf_cor(catfile($usr_home, 'cor.conf'), $sys_home);
|
prepareUttUsrHome($usr_home);
|
||||||
conf_grp(catfile($usr_home, 'grp.conf'), $sys_home);
|
conf_cor(catfile($usr_home, 'cor.conf'), $sys_home);
|
||||||
conf_gue(catfile($usr_home, 'gue.conf'), $sys_home);
|
conf_grp(catfile($usr_home, 'grp.conf'), $sys_home);
|
||||||
conf_lem(catfile($usr_home, 'lem.conf'), $sys_home);
|
conf_gue(catfile($usr_home, 'gue.conf'), $sys_home);
|
||||||
conf_ser(catfile($usr_home, 'ser.conf'), $sys_home);
|
conf_lem(catfile($usr_home, 'lem.conf'), $sys_home);
|
||||||
conf_utt(catfile($usr_home, 'utt.conf'), $sys_home);
|
conf_ser(catfile($usr_home, 'ser.conf'), $sys_home);
|
||||||
|
conf_utt(catfile($usr_home, 'utt.conf'), $sys_home);
|
||||||
print "UTT user configuration created in $usr_home\n";
|
|
||||||
|
print "UTT user configuration created in $usr_home\n";
|
||||||
|
|
||||||
|
|
||||||
#Kasuje stare configi i tworzy katalog .utt
|
|
||||||
sub prepareUttUsrHome() {
|
#Kasuje stare configi i tworzy katalog .utt
|
||||||
my $dir = shift;
|
sub prepareUttUsrHome() {
|
||||||
|
my $dir = shift;
|
||||||
if(-d $dir) {
|
|
||||||
print "Old configuration will be deleted!\n";
|
if(-d $dir) {
|
||||||
my $cnt = unlink <$dir/*>;
|
print "Old configuration will be deleted!\n";
|
||||||
print "$cnt files deleted.\n";
|
my $cnt = unlink <$dir/*>;
|
||||||
}
|
print "$cnt files deleted.\n";
|
||||||
else {
|
}
|
||||||
print "Creating directory $dir\n";
|
else {
|
||||||
if(1 != mkdir $dir) {
|
print "Creating directory $dir\n";
|
||||||
die "Unable to create UTT user configuration!\n";
|
if(1 != mkdir $dir) {
|
||||||
}
|
die "Unable to create UTT user configuration!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
# Tworzy naglowek dla wszystkich plikow konfiguracyjnych
|
|
||||||
sub makeConfigHeader() {
|
# Tworzy naglowek dla wszystkich plikow konfiguracyjnych
|
||||||
return "# ************************************************************\n".
|
sub makeConfigHeader() {
|
||||||
"# * This file was created automatically during installation. *\n".
|
return "# ************************************************************\n".
|
||||||
"# * If you don't need do not change it. *\n".
|
"# * This file was created automatically during installation. *\n".
|
||||||
"# * *\n".
|
"# * If you don't need do not change it. *\n".
|
||||||
"# * UAM Text Tools *\n".
|
"# * *\n".
|
||||||
"# * Adam Mickiewicz University, Poland *\n".
|
"# * UAM Text Tools *\n".
|
||||||
"# * http://utt.amu.edu.pl *\n".
|
"# * Adam Mickiewicz University, Poland *\n".
|
||||||
"# ************************************************************\n".
|
"# * http://utt.amu.edu.pl *\n".
|
||||||
"#\n".
|
"# ************************************************************\n".
|
||||||
"# All lines must looks like:\n".
|
"#\n".
|
||||||
"# parameter_name [=] value\n".
|
"# All lines must looks like:\n".
|
||||||
"#\n\n";
|
"# parameter_name [=] value\n".
|
||||||
}
|
"#\n\n";
|
||||||
|
}
|
||||||
sub conf_cor() {
|
|
||||||
my $cor_file = shift;
|
sub conf_cor() {
|
||||||
my $utthome = shift;
|
my $cor_file = shift;
|
||||||
open(FILE, ">$cor_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$cor_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
print FILE "dictionary-home=", abs_path("$utthome/share/utt"), "\n";
|
print FILE makeConfigHeader();
|
||||||
|
print FILE "dictionary-home=", abs_path("$utthome/share/utt"), "\n";
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
sub conf_grp() {
|
|
||||||
my $grp_file = shift;
|
sub conf_grp() {
|
||||||
my $utthome = shift;
|
my $grp_file = shift;
|
||||||
open(FILE, ">$grp_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$grp_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
print FILE "macros=", abs_path("$utthome/lib/utt/terms.m4"), "\n";
|
print FILE makeConfigHeader();
|
||||||
|
print FILE "macros=", abs_path("$utthome/lib/utt/terms.m4"), "\n";
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
sub conf_gue() {
|
|
||||||
my $gue_file = shift;
|
sub conf_gue() {
|
||||||
my $utthome = shift;
|
my $gue_file = shift;
|
||||||
open(FILE, ">$gue_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$gue_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
|
print FILE makeConfigHeader();
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
sub conf_lem() {
|
|
||||||
my $lem_file = shift;
|
sub conf_lem() {
|
||||||
my $utthome = shift;
|
my $lem_file = shift;
|
||||||
open(FILE, ">$lem_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$lem_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
print FILE "dictionary-home=", abs_path("$utthome/share/utt"), "\n";
|
print FILE makeConfigHeader();
|
||||||
|
print FILE "dictionary-home=", abs_path("$utthome/share/utt"), "\n";
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
sub conf_ser() {
|
|
||||||
my $ser_file = shift;
|
sub conf_ser() {
|
||||||
my $utthome = shift;
|
my $ser_file = shift;
|
||||||
open(FILE, ">$ser_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$ser_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
print FILE "macros=", abs_path("$utthome/lib/utt/terms.m4"), "\n";
|
print FILE makeConfigHeader();
|
||||||
print FILE "flex-template=", abs_path("$utthome/lib/utt/ser.l.template"), "\n";
|
print FILE "macros=", abs_path("$utthome/lib/utt/terms.m4"), "\n";
|
||||||
|
print FILE "flex-template=", abs_path("$utthome/lib/utt/ser.l.template"), "\n";
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
sub conf_utt() {
|
|
||||||
my $utt_file = shift;
|
sub conf_utt() {
|
||||||
my $utthome = shift;
|
my $utt_file = shift;
|
||||||
open(FILE, ">$utt_file");
|
my $utthome = shift;
|
||||||
|
open(FILE, ">$utt_file");
|
||||||
print FILE makeConfigHeader();
|
|
||||||
print FILE "# user locale\n";
|
print FILE makeConfigHeader();
|
||||||
print FILE "language=", findLocale(), "\n";
|
print FILE "# user locale\n";
|
||||||
|
print FILE "language=", findLocale(), "\n";
|
||||||
close FILE;
|
|
||||||
}
|
close FILE;
|
||||||
|
}
|
||||||
# Szuka locali u uzytkownika
|
|
||||||
sub findLocale() {
|
# Szuka locali u uzytkownika
|
||||||
$cur_locale = setlocale(LC_CTYPE);
|
sub findLocale() {
|
||||||
|
$cur_locale = setlocale(LC_CTYPE);
|
||||||
# we replace Latinx to ISO-8859-x
|
|
||||||
$cur_locale =~ s/(.+?)Latin(.+?)/$1ISO\-8859\-$2/g;
|
# we replace Latinx to ISO-8859-x
|
||||||
|
$cur_locale =~ s/(.+?)Latin(.+?)/$1ISO\-8859\-$2/g;
|
||||||
if($cur_locale =~ /\w+_\w+\.\S+/) {
|
|
||||||
$best_locale = $cur_locale;
|
if($cur_locale =~ /\w+_\w+\.\S+/) {
|
||||||
}
|
$best_locale = $cur_locale;
|
||||||
elsif($cur_locale =~ /\w+_\w+/) {
|
}
|
||||||
$best_locale = $cur_locale.".UTF-8";
|
elsif($cur_locale =~ /\w+_\w+/) {
|
||||||
}
|
$best_locale = $cur_locale.".UTF-8";
|
||||||
else {
|
}
|
||||||
$best_locale = toupper($cur_locale).'_'.tolower($cur_locale).'.UTF-8';
|
else {
|
||||||
}
|
$best_locale = toupper($cur_locale).'_'.tolower($cur_locale).'.UTF-8';
|
||||||
return $best_locale;
|
}
|
||||||
}
|
return $best_locale;
|
||||||
|
}
|
||||||
|
71
app/dist/deb/Makefile
vendored
71
app/dist/deb/Makefile
vendored
@ -1,53 +1,58 @@
|
|||||||
#default task
|
#default task
|
||||||
|
|
||||||
|
DIR=$(shell pwd)
|
||||||
|
|
||||||
|
ifndef UTT_DIST_DIR
|
||||||
|
UTT_DIST_DIR=${DIR}
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef UTT_DIST_OUTPUT
|
||||||
|
UTT_DIST_OUTPUT=${DIR}
|
||||||
|
endif
|
||||||
|
|
||||||
# here there're few properties
|
# here there're few properties
|
||||||
_PRODUCT_NAME=utt
|
_PRODUCT_NAME=utt
|
||||||
_BUILD_DIR=$(_UTT_BIN_DIR)
|
|
||||||
_UTT_VER=$(shell cat ../common/version.def)
|
_UTT_VER=$(shell cat ../common/version.def)
|
||||||
_UTT_REL=$(shell cat ../common/release.def)
|
_UTT_REL=$(shell cat ../common/release.def)
|
||||||
_DEB_ROOT=$(shell pwd)/deb_root
|
_DEB_FROOT=$(DIR)/deb_root
|
||||||
_INSTALL_DIR=/usr/local/$(_PRODUCT_NAME)/$(_UTT_VER)-$(_UTT_REL)
|
_UTT_DIR=${_DEB_FROOT}/usr/local/$(_PRODUCT_NAME).$(_UTT_VER)-$(_UTT_REL)
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
default:
|
default: make_control make_postinst make_prerm
|
||||||
# we need some extra configuration files
|
|
||||||
make_control
|
|
||||||
make_postinst
|
|
||||||
|
|
||||||
# first, we prepare some directory structure
|
# first, we prepare some directory structure
|
||||||
mkdir -p $(_DEB_ROOT)/DEBIAN
|
mkdir -p $(_DEB_FROOT)/DEBIAN
|
||||||
mkdir -p $(_DEB_ROOT)$(_INSTALL_DIR)
|
mkdir -p $(_UTT_DIR)
|
||||||
mkdir -p $(_DEB_ROOT)/usr/share/man/man1
|
|
||||||
mkdir -p $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)
|
|
||||||
|
|
||||||
find $(_DEB_ROOT) -type d | xargs chmod 755 # this is necessary on Debian Woody, don't ask me why
|
# next, we copy deb package files
|
||||||
|
mv ./control $(_DEB_FROOT)/DEBIAN/
|
||||||
|
mv ./postinst $(_DEB_FROOT)/DEBIAN/
|
||||||
|
mv ./prerm $(_DEB_FROOT)/DEBIAN/
|
||||||
|
cd ${_DEB_FROOT} && tar -cvvf control.tar.gz DEBIAN/
|
||||||
|
cd ${DIR};
|
||||||
|
rm -fr ${_DEB_FROOT}/DEBIAN/
|
||||||
|
|
||||||
# next, we copy necessary files
|
# we copy all necessery files (binaries)
|
||||||
mv ./control $(_DEB_ROOT)/DEBIAN/
|
cp -r ${UTT_DIST_DIR}/* ${_UTT_DIR}/
|
||||||
cp ./postinst $(_DEB_ROOT)/DEBIAN/
|
cp ./changelog ${_UTT_DIR}/share/doc/$(_PRODUCT_NAME)/
|
||||||
cp ./prerm $(_DEB_ROOT)/DEBIAN/
|
|
||||||
# cp -r $(_BUILD_DIR)/man/* $(_DEB_ROOT)/usr/share/man/
|
|
||||||
cp $(_BUILD_DIR)/COPYRIGHT $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/copyright
|
|
||||||
# cp $(_BUILD_DIR)/changelog $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
|
|
||||||
# cp $(_BUILD_DIR)/changelog.Debian $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
|
|
||||||
|
|
||||||
|
|
||||||
# next we make man/doc archives
|
|
||||||
# gzip --best $(_DEB_ROOT)/usr/share/man/man1/$(_PRODUCT_NAME).1
|
|
||||||
# gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog
|
# gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog
|
||||||
|
cp ./changelog.Debian $(_UTT_DIR)/share/doc/$(_PRODUCT_NAME)/
|
||||||
# gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian
|
# gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian
|
||||||
# tar -cvvf control.tar.gz ${_DEB_ROOT}/DEBIAN/
|
cp ../files/* ${_UTT_DIR}/share/doc/${_PRODUCT_NAME}/
|
||||||
# rm -fr ${_DEB_ROOT}/DEBIAN/
|
cp ../common/utt_make_config.pl ${_UTT_DIR}/bin/
|
||||||
|
chmod 755 ${_UTT_DIR}/bin/utt_make_config.pl
|
||||||
|
|
||||||
|
|
||||||
# and binaries
|
|
||||||
cp -rv $(_BUILD_DIR)/* $(_DEB_ROOT)$(_INSTALL_DIR)/
|
|
||||||
# tar -cvvf data.tar.gz ${_DEB_ROOT}/
|
|
||||||
# rm -fr ${_DEB_ROOT}/
|
|
||||||
|
|
||||||
|
# # next we make man/doc archives
|
||||||
|
# gzip --best $(_DEB_ROOT)/usr/share/man/man1/$(_PRODUCT_NAME).1
|
||||||
|
|
||||||
|
find $(_DEB_FROOT) -type d | xargs chmod 755 # this is necessary on Debian Woody, don't ask me why
|
||||||
|
|
||||||
# finally, we buid deb package
|
# finally, we buid deb package
|
||||||
fakeroot dpkg-deb --build $(_DEB_ROOT)
|
fakeroot dpkg-deb --build $(_DEB_FROOT)
|
||||||
mv $(_DEB_ROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb
|
mv $(_DEB_FROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb
|
||||||
|
rm -rf ${_DEB_FROOT}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: make_control
|
.PHONY: make_control
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user