PRBEM / IRBEM

IRBEM-LIB provides routines to compute magnetic coordinates for any location in the Earth's magnetic field, to perform coordinate conversions, to evaluate geophysics/space-physics models, and to propagate orbits in time.
https://prbem.github.io/IRBEM/
Other
33 stars 14 forks source link

IRBEM lib as submodule #20

Open xandrd opened 3 years ago

xandrd commented 3 years ago

https://github.com/PRBEM/IRBEM/blob/a4759c0ea30159d4134d3616316bf90d299a03b8/Makefile#L48

When IRBEM library is created as a submodule, .git is a file, not a directory. Hence, make fails to get the variable GIT_RELEASE and GIT_REV correctly. The workaround is to change .git to .github.

Quick steps to reproduce:

mkdir repo_with_submodule
cd repo_with_submodule
git init
git submodule add https://github.com/PRBEM/IRBEM.git
cd IRBEM
ls -la
AntoineBrunet commented 3 years ago

Hi! Thanks for raising this issue. Maybe we should replace the -d check with a -e check, which would also match a file. I'm wondering how portable this is on non-unix environments though. If someone has an idea on how to do this portably it would be a good idea.

Also, while correcting this, we should have sensible defaults if the library is not compiled from a git repository.

xandrd commented 3 years ago

I agree. We had some problems compiling the library on MAC, which we solved by manually introducing files fortran_version.inc, fortran_release.inc, ntime_max.inc. Sometimes, make does not create them due to the incompatible environment.

Perhaps, the pre-compiled libraries (e.g., windows dlls) can be added as [github relase].(https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/about-releases).

mshumko commented 2 years ago

@AntoineBrunet, I have not looked into this issue, but can we remove the git parts from the Makefile? I propose this solution because it also breaks the Windows 10 build when I use PowerShell or Command Prompt. As a workaround, I have to use a 3rd party bash on Windows to get it to compile.

xandrd commented 2 years ago

Is it possible to create fortran_release.inc via github actions? In this case the file will be always available in the repository and the Makefile does not have to create it using git.

xandrd commented 2 years ago

@AntoineBrunet BTW, thank you for introducing if [ -e .git ]. I can confirm that the issue with submodules is resolved. However, as @mshumko mentioned before, if would be great if we can find a different solution that does not involve bash or git in the Makefile.