dfandrich / gpscorrelate

C program to match GPS tracks to photographs, and store the matches in the EXIF data in the photographs.
https://dfandrich.github.io/gpscorrelate/
GNU General Public License v2.0
28 stars 8 forks source link

Fix locale search path #7

Closed sikmir closed 5 years ago

sikmir commented 5 years ago

Actual behaviour

$ make prefix=/path/to/install CFLAGS=-DENABLE_NLS
$ make prefix=/path/to/install install install-po install-desktop-file
$ LANG=ru_RU.UTF-8 strace -T -e trace=openat -- /path/to/install/bin/gpscorrelate-gui 2>&1 | egrep 'locale/ru/(.*)gpscorrelate'
openat(AT_FDCWD, "/usr/share/locale/ru/LC_MESSAGES/gpscorrelate.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000013>

Expected behaviour

$ make prefix=/path/to/install CFLAGS=-DENABLE_NLS
$ make prefix=/path/to/install install install-po install-desktop-file
$ LANG=ru_RU.UTF-8 strace -T -e trace=openat -- /path/to/install/bin/gpscorrelate-gui 2>&1 | egrep 'locale/ru/(.*)gpscorrelate'
openat(AT_FDCWD, "/path/to/install/share/locale/ru/LC_MESSAGES/gpscorrelate.mo", O_RDONLY) = 3 <0.000029>

For more details, see bindtextdomain.

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 241


Totals Coverage Status
Change from base Build 239: 0.0%
Covered Lines: 920
Relevant Lines: 966

💛 - Coveralls
dfandrich commented 5 years ago

Conceptually looks fine. Could you add another call to bindtextdomain in the CLI and ensure that $(localedir) gets passed in to the po targets so someone overriding localedir will get the files installed in the right place?

sikmir commented 5 years ago

Could you add another call to bindtextdomain in the CLI

Added.

and ensure that $(localedir) gets passed in to the po targets so someone overriding localedir will get the files installed in the right place?

$ make prefix=/path/to/install localedir=/path/to/locale CFLAGS=-DENABLE_NLS
$ make prefix=/path/to/install localedir=/path/to/locale install install-po install-desktop-file
$ LANG=ru_RU.UTF-8 strace -T -e trace=openat -- /path/to/install/bin/gpscorrelate-gui 2>&1 | egrep 'locale/ru/(.*)gpscorrelate'
openat(AT_FDCWD, "/path/to/locale/ru/LC_MESSAGES/gpscorrelate.mo", O_RDONLY) = 3 <0.000009>
$ LANG=ru_RU.UTF-8 strace -T -e trace=openat -- /path/to/install/bin/gpscorrelate 2>&1 | egrep 'locale/ru/(.*)gpscorrelate'
openat(AT_FDCWD, "/path/to/locale/ru/LC_MESSAGES/gpscorrelate.mo", O_RDONLY) = 3 <0.000010>
dfandrich commented 5 years ago

I'm thinking of a case where localedir is not where prefix would put it, e.g.,

$ make prefix=/path/to/install localedir=/somewhere/else/locale CFLAGS=-DENABLE_NLS
sikmir commented 5 years ago

I'm thinking of a case where localedir is not where prefix would put it, e.g.,

$ make prefix=/path/to/install localedir=/somewhere/else/locale CFLAGS=-DENABLE_NLS

See my comment above, that works as expected.

dfandrich commented 5 years ago

Ah, I see, using make magic. Thanks!