New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language-path option to config #474

Open
ismell opened this Issue Nov 5, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@ismell

ismell commented Nov 5, 2017

Same thing as help-path and mod-path but for language files.

@vanosg

This comment has been minimized.

Show comment
Hide comment
@vanosg

vanosg Nov 6, 2017

Collaborator

To better evaluate this, can you help provide a use case for when/why language paths would be elsewhere? The more we can understand user intent, the (hopefully) better product we can churn out. Thanks!

Collaborator

vanosg commented Nov 6, 2017

To better evaluate this, can you help provide a use case for when/why language paths would be elsewhere? The more we can understand user intent, the (hopefully) better product we can churn out. Thanks!

@ismell

This comment has been minimized.

Show comment
Hide comment
@ismell

ismell Nov 7, 2017

I have an eggdrop installed by a package manager. Without being able to set the help-path it requires that I either make a symlink to the help dir in my bots working directory to the system provided help path, or patch the headers with the system help path. See https://github.com/ismell/pkgsrc/blob/6aceea71d3e95aa947ba50282e8f0e60adb2b238/chat/eggdrop/patches/patch-langdir and https://github.com/ismell/pkgsrc/blob/6aceea71d3e95aa947ba50282e8f0e60adb2b238/chat/eggdrop/Makefile#L18

ismell commented Nov 7, 2017

I have an eggdrop installed by a package manager. Without being able to set the help-path it requires that I either make a symlink to the help dir in my bots working directory to the system provided help path, or patch the headers with the system help path. See https://github.com/ismell/pkgsrc/blob/6aceea71d3e95aa947ba50282e8f0e60adb2b238/chat/eggdrop/patches/patch-langdir and https://github.com/ismell/pkgsrc/blob/6aceea71d3e95aa947ba50282e8f0e60adb2b238/chat/eggdrop/Makefile#L18

@michaelortmann

This comment has been minimized.

Show comment
Hide comment
@michaelortmann

michaelortmann Aug 23, 2018

Contributor

see #176
netbsd doesn't want us to hardcode a relative LANGDIR:
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/chat/eggdrop/patches/patch-src_eggdrop.h
see also:
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/chat/eggdrop/PLIST

i was also thinking, whether the netbsd packaging may be wrong here, but meanwhile i see other packagings are also patching it somehow, for example arch linux aur:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eggdrop

[...]
Don't complain about language files on startup.
sed -i "s|"./language"|"$_sharedir/$pkgname/language"|g" src/eggdrop.h
[...]
for d in language scripts help text; do
mv "$eggtmp/${d}" "$pkgdir/$_sharedir/$pkgname"
done
[...]

so, currently eggdrop is meant to be installed into a single user directory like /home/user/eggdrop or single systemwide directory like /opt/eggdrop but its not friendly to package managers who want to install eggdrop into "normal" system directories to fit into the existing file system structure with /usr/share and the like.

so this issue is about package manager friendliness, and here is a real bug to fix.

there is more: in language.c there is:
src/language.c: char *ldir = getenv("EGG_LANGDIR");
so besides the netbsd and arch linux solutions there would be a 3rd solution: via environment variable.
but i its deep hidden in the source, and neither systems picked it up.
so i would also like to get rid of that variable in favor of a more general solution
as we use it already for other directory paths

btw: we have addlang config option. we should not need an alternative environment var EGG_LANG.

my first proposal was:
new eggdrop.conf variable lang-path
remove LANGDIR from eggdrop.h and set default lang-path in eggdrop.conf
( CFLAGS -DLANGDIR is not supported without netbsd patch, so we can remove it for 1.8, but we should drop the package maintainer of eggdrop pkgsrc a note about the change )
deprecate warning for EGG_LANG and EGG_LANGUAGE for 1.8, and removal for 1.9

but then i saw, this is NOT possible.
eggdrop loads languages before loading its config file, so that new config variable wouldn't be available in time

i looked at the package install in netbsd and arch linux aur
and i think netbsd does it right
but arch linux aur is flawed, and it knows when it comments:
"This is ugly.."
in:
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eggdrop

so now proposal is, to set the language path, like you would set library path,
with a config option for configure
--languagedir=DIR user executables [EPREFIX/language]
or utilize datarootdir (.../share/eggdrop/)

i think its time, to not install eggdrop to users home by default,
but, like any other package out there, install to /usr...
and let the user change this with ./configure --prefix

Contributor

michaelortmann commented Aug 23, 2018

see #176
netbsd doesn't want us to hardcode a relative LANGDIR:
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/chat/eggdrop/patches/patch-src_eggdrop.h
see also:
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/chat/eggdrop/PLIST

i was also thinking, whether the netbsd packaging may be wrong here, but meanwhile i see other packagings are also patching it somehow, for example arch linux aur:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eggdrop

[...]
Don't complain about language files on startup.
sed -i "s|"./language"|"$_sharedir/$pkgname/language"|g" src/eggdrop.h
[...]
for d in language scripts help text; do
mv "$eggtmp/${d}" "$pkgdir/$_sharedir/$pkgname"
done
[...]

so, currently eggdrop is meant to be installed into a single user directory like /home/user/eggdrop or single systemwide directory like /opt/eggdrop but its not friendly to package managers who want to install eggdrop into "normal" system directories to fit into the existing file system structure with /usr/share and the like.

so this issue is about package manager friendliness, and here is a real bug to fix.

there is more: in language.c there is:
src/language.c: char *ldir = getenv("EGG_LANGDIR");
so besides the netbsd and arch linux solutions there would be a 3rd solution: via environment variable.
but i its deep hidden in the source, and neither systems picked it up.
so i would also like to get rid of that variable in favor of a more general solution
as we use it already for other directory paths

btw: we have addlang config option. we should not need an alternative environment var EGG_LANG.

my first proposal was:
new eggdrop.conf variable lang-path
remove LANGDIR from eggdrop.h and set default lang-path in eggdrop.conf
( CFLAGS -DLANGDIR is not supported without netbsd patch, so we can remove it for 1.8, but we should drop the package maintainer of eggdrop pkgsrc a note about the change )
deprecate warning for EGG_LANG and EGG_LANGUAGE for 1.8, and removal for 1.9

but then i saw, this is NOT possible.
eggdrop loads languages before loading its config file, so that new config variable wouldn't be available in time

i looked at the package install in netbsd and arch linux aur
and i think netbsd does it right
but arch linux aur is flawed, and it knows when it comments:
"This is ugly.."
in:
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eggdrop

so now proposal is, to set the language path, like you would set library path,
with a config option for configure
--languagedir=DIR user executables [EPREFIX/language]
or utilize datarootdir (.../share/eggdrop/)

i think its time, to not install eggdrop to users home by default,
but, like any other package out there, install to /usr...
and let the user change this with ./configure --prefix

michaelortmann pushed a commit to michaelortmann/eggdrop that referenced this issue Aug 27, 2018

@michaelortmann

This comment has been minimized.

Show comment
Hide comment
@michaelortmann

michaelortmann Aug 27, 2018

Contributor

irc discussion result:

change ./configure --prefix to install all parts off eggdrop into 'expected' directories, like prefix/bin and prefix/lib. will ease system wide installation, as long as you remember, you have to specify --prefix /usr explicitely because if you dont, then eggdrop will install in a backward compatible manner into the users home.

we can also change that backward compatible manner with eggdrop 2.0, i hope.

the new --prefix behaviour is fine even for multiple eggdrops per user, because we already have the -c option to start each eggdrop with.

the new --prefix behavior will also bring us better support for language directory, because then it can be specified at configure time. we could even add a --languagedir option to configure.

the test could preferably be done with package managers like dbrewery, because i see freebsd eggdrop ports are kind of... zombies... 1.6.21_1 and 1.8.0.20141008_2.

see also hier(7) to see which files should be put in which directories.

don't worry about telling the user to set LD_LIBRARY_PATH, if eggdrop is installed with ./configure/make... it will know where to find stuff and thus it will be able to load modules/etc there and could set whatever ENV it needs itself.

we also want this prefix change, because of #709

Contributor

michaelortmann commented Aug 27, 2018

irc discussion result:

change ./configure --prefix to install all parts off eggdrop into 'expected' directories, like prefix/bin and prefix/lib. will ease system wide installation, as long as you remember, you have to specify --prefix /usr explicitely because if you dont, then eggdrop will install in a backward compatible manner into the users home.

we can also change that backward compatible manner with eggdrop 2.0, i hope.

the new --prefix behaviour is fine even for multiple eggdrops per user, because we already have the -c option to start each eggdrop with.

the new --prefix behavior will also bring us better support for language directory, because then it can be specified at configure time. we could even add a --languagedir option to configure.

the test could preferably be done with package managers like dbrewery, because i see freebsd eggdrop ports are kind of... zombies... 1.6.21_1 and 1.8.0.20141008_2.

see also hier(7) to see which files should be put in which directories.

don't worry about telling the user to set LD_LIBRARY_PATH, if eggdrop is installed with ./configure/make... it will know where to find stuff and thus it will be able to load modules/etc there and could set whatever ENV it needs itself.

we also want this prefix change, because of #709

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment