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

Make - use relative paths #7519

Merged
merged 8 commits into from May 11, 2024
Merged

Make - use relative paths #7519

merged 8 commits into from May 11, 2024

Conversation

dimitre
Copy link
Member

@dimitre dimitre commented Apr 22, 2023

not meant to work with spaces in project name
only when you are using a system you can't modify the username and it has spaces.
so make only work with relative paths, and if your project located inside OF folder everything works.

PS: Tested only on macOS, OF was installed in a folder called "of 3"

@dimitre dimitre marked this pull request as ready for review April 22, 2023 22:34
@dimitre dimitre added this to the 0.12.0 milestone Apr 22, 2023
@artificiel
Copy link
Contributor

the realpath was added to make the parsing "more accurate" — not sure what the inaccuracies might have been, but still... reverting to a prior state raises questions.

that being said, Make is notoriously anti-space (see https://stackoverflow.com/questions/61592591/makefiles-with-spaces-in-filepath#comment108950849_61592591 -- madScientist is maintainer of Make). without knowing what might be affected by the changes, not sure "working around" for what amounts to a partial solution is worth the risks (and/or the time required to harness tests guaranteeing there are no side-effects).

@dimitre
Copy link
Member Author

dimitre commented Apr 23, 2023

Let's test it in different environments and find out. I have some different Linux setups to test later today.
Do you have access to some windows box?

I don't even need this in my setup, but I think it is important to have OF working on teaching environments.

@artificiel
Copy link
Contributor

of course anything that helps a bit is good, but my point is more to put in perspective the calories spent on the build system.

anyhow, without being a perfect technique, I find that escaping spaces tend to survive better the scenarios of appending path strings in scripts than trying to quote them (as the quotes must be carefully maintained each time an operation is performed).

starting with such as

OF_ROOT=`realpath ../../.. | sed 's/ /\\ /g'` 

maybe there's a way to have spaces work while keeping realpath in the loop.

(no windows unfortunately here)

@dimitre
Copy link
Member Author

dimitre commented Apr 23, 2023

So I thought it was some kind of subtle dry humor in double quotes "more accurate", but it seems you really have a point in using having realpath always present in Makefiles (not a native english speaker here, so I get lost on language subtleties).
I would love to know the reasoning behind it, to get up to date with your mentation process

@dimitre dimitre marked this pull request as draft April 23, 2023 22:29
@artificiel
Copy link
Contributor

ah! but the "more accurate" is in the git blame!
image

@dimitre
Copy link
Member Author

dimitre commented Apr 24, 2023

Thanks!

@dimitre dimitre modified the milestones: 0.12.0, 0.12.1 Aug 31, 2023
@dimitre dimitre marked this pull request as ready for review May 7, 2024 16:05
@dimitre
Copy link
Member Author

dimitre commented May 7, 2024

@ofTheo @artificiel I can't see any downsides to using relative paths in Make.
It will solve the classic issue of a computer with a space in username. like /Users/tim hecker/openFrameworks

@artificiel
Copy link
Contributor

yes I think it's 2 things: the spaces in path is separated from the absolute/relative concept.

relative sounds fine and will work even if the "higher" path contains spaces, and the user keeps projects inside OF folder. that covers a lot, but if the projects are outside OF folder, then it depends, spaces might still break things. but i mentioned above I was wondering why the introduction of realpath was made (as it creates "hardwired" projects) and the notice is that it is more "accurate". I don't know what the inaccuracies could have been? maybe there are other positive sanitizing side effects? but it's worth a try. maybe a flag in PG to toggle absolute vs relative?

for the spaces, I was referring to the Make maintainer who says it's a hard combat (unfortunately the link above is broken) and that there is no official support http://savannah.gnu.org/bugs/?712 but if one is determined to try to make it work, escaping spaces is found to be a more resilient approach than quoting the whole path.

@dimitre
Copy link
Member Author

dimitre commented May 9, 2024

Yes it is separated
spaces will continue to be an issue inside OF folder organization, which is easily addressable by the user.
But it will address issues arising from /Users/谢 谢/ofw
issues from the past (I've seen some) arised from education environments, or when people used computers without admin access.
to separate and tangential issues are: using less absolute paths in the core, and addressing windows encoding issues with multiple languages (there is a PR ready for this one)

@dimitre
Copy link
Member Author

dimitre commented May 9, 2024

@ofTheo I think this one is good to go
Any opinion on this one?
I think scripts/linux/examplesMakeTemplate.sh file can be removed

@dimitre dimitre changed the title Make - make it work using spaces in paths Make - use relative paths, so usernames with spaces and foreign characteres are OK May 11, 2024
@dimitre dimitre changed the title Make - use relative paths, so usernames with spaces and foreign characteres are OK Make - use relative paths, so path starting with spaces and foreign characteres are OK May 11, 2024
@dimitre dimitre changed the title Make - use relative paths, so path starting with spaces and foreign characteres are OK Make - use relative paths, so path starting with spaces and non latin letters are OK May 11, 2024
@dimitre dimitre changed the title Make - use relative paths, so path starting with spaces and non latin letters are OK Make - use relative paths May 11, 2024
@dimitre dimitre merged commit c705b4e into openframeworks:master May 11, 2024
11 checks passed
@dimitre dimitre deleted the makerel branch May 18, 2024 00:12
danoli3 added a commit to danoli3/openFrameworks that referenced this pull request May 20, 2024
…leedingmacOS

* commit '7f37e70f65e9e022ba8868fb555570ce2c78a6ba': (37 commits)
  Allows Retina hi res enabled via App or Project.xcconfig (openframeworks#7971)
  actions changes (openframeworks#7968)
  Changing exr to hdr files for compatability with windows (openframeworks#7964)
  ofMesh - newfaces push_back to insert a list (openframeworks#7772)
  restore default-copy-constructibility of ofEvent (openframeworks#7969)
  [actions] ccache update (openframeworks#7967)
  Core small changes (openframeworks#7952)
  config.emscripten.default.mk for Emscripten >= 3.1.52 (openframeworks#7909)
  Fix edge case in findDelimiter (openframeworks#7911)
  oscpack / udpSocket: invert the "break_" semaphore (openframeworks#7963)
  ofxOscMessage: extra implicit adds [fixes something noted through openframeworks#7938 debugging] (openframeworks#7953) #changelog #ofxOsc
  ofThreadChannel::clear() to clear the channel (openframeworks#7921) #changelog #threadChannel
  OfxOscReceiver: from detach() to join() (openframeworks#7949)
  Update ofMathConstants.h (openframeworks#7958)
  [actions] update ubuntu 24.04 (openframeworks#7955)
  ofScopedMatrix (openframeworks#7946)
  [actions] - testing one action with multiple jobs for tests (openframeworks#7860)
  adding of.entitlements and vscode files to gitignore (openframeworks#7031)
  Make - use relative paths (openframeworks#7519)
  FPS timing with chrono (openframeworks#7867)
  ...

# Conflicts:
#	libs/openFrameworks/sound/ofAVEngineSoundPlayer.mm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants