Skip to content
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

OSTYPE environmental variable in the orca script #132

Open
BoundaryValueProblems opened this issue Sep 22, 2018 · 2 comments
Open

OSTYPE environmental variable in the orca script #132

BoundaryValueProblems opened this issue Sep 22, 2018 · 2 comments

Comments

@BoundaryValueProblems
Copy link

When I installed the latest version of orca via ORCA.jl (v0.1.0) under Julia v1.0 on my MacBook Pro (OS X 10.11.6), and ran using ORCA. Then it complained:

/Users/xxx/.julia/packages/ORCA/vWe2Y/deps/bin/orca: line 7: /Users/xxx/.julia/packages/ORCA/vWe2Y/deps/lib/orca_app/orca: No such file or directory
/Users/xxx/.julia/packages/ORCA/vWe2Y/deps/bin/orca: line 7: exec: /Users/xxx/.julia/packages/ORCA/vWe2Y/deps/lib/orca_app/orca: cannot execute: No such file or directory

So, I took a look at deps/bin/orga:

#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then

Mac OSX

exec /Users/xxx/.julia/packages/ORCA/vWe2Y/deps/lib/orca.app/Contents/MacOS/orca "$@"
else

Assume linux

exec /Users/xxx/.julia/packages/ORCA/vWe2Y/deps/lib/orca_app/orca "$@"
fi

Since in my ~/.bashrc, I define export OSTYPE=uname, on my MacBook Pro, the value of OSTYPE is Darwin, not darwin. Of couse, I could suppress that line in my ~/.bashrc, but in general, we never know what each user handles the OSTYPE variable, it would be a bit risky to just judge if "$OSTYPE" == "darwin", in my opinion. Perhaps, at least, we should check whether [[ "$OSTYPE" == "darwin" ] || [ "$OSTYPE" == "Darwin"* ]]. (Perhaps, there is a better way to check a word with a case insensitive way in bash...)
Thanks a lot to address this problem!

@jonmmease
Copy link
Contributor

Hi @BoundaryValueProblems, thanks for the report.

The best way forward is probably to move all of the OSTYPE-based logic into the build process and create a different bin/orca shell script for MacOs and Linux.

Something like:

Remove this line:

cp $RECIPE_DIR/bin/orca $ORCA_ENTRY

and remove the recipe/bin/orca script.

Then add recipe/bin/orca_osx and recipe/bin/orca_linux template scripts that contain only the exec line for that OS, and don't include the OSTYPE conditional logic

Update the OSTYPE conditional logic in reciple/build.sh to copy the correct template script for that OS.


if [[ "$OSTYPE" == "darwin"* ]]; then
    # Mac OSX
    mv release/mac/orca.app $PREFIX/lib
    cp $RECIPE_DIR/bin/orca_osx $ORCA_ENTRY
else
    # Assume Linux
    mv release/linux-unpacked/ $PREFIX/lib/orca_app
    cp $RECIPE_DIR/bin/orca_linux $ORCA_ENTRY
fi

Are you interested in creating a PR with these changes?

@BoundaryValueProblems
Copy link
Author

@jonmmease Thanks a lot for your comments! I would greatly appreciate it if you could do pull request rather than doing it myself since I am not familar with npm, etc. Thanks!

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

No branches or pull requests

3 participants