-
Notifications
You must be signed in to change notification settings - Fork 175
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
Fixes discover.ml to support platforms that use PKGSRC #79
Conversation
in | ||
List.flatten [ | ||
get "C_INCLUDE_PATH" (fun dir -> (dir, dir // ".." // "lib")); | ||
get "LIBRARY_PATH" (fun dir -> (dir // ".." // "include", dir)); | ||
get "C_INCLUDE_PATH" (fun dir -> (dir, Str.replace_first reInc (Filename.dir_sep ^ "lib") dir)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this replace the last occurrence instead of the last one? I guess this is unlikely that a patch contains twice include
or lib
but if it happens we'd probably want to replace the last one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use Str.global_replace
?
Sorry for the sloppy pull-request; it's the first time I've done this on GitHub. Next time, I'll make a branch on my forked repo so I won't be committing to |
in | ||
List.flatten [ | ||
get "C_INCLUDE_PATH" (fun dir -> (dir, dir // ".." // "lib")); | ||
get "LIBRARY_PATH" (fun dir -> (dir // ".." // "include", dir)); | ||
get "C_INCLUDE_PATH" (fun dir -> (dir, Str.global_replace reInc (Filename.dir_sep ^ "lib") dir)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced by global_replace
either. I think in general what makes the most sense is to replace the last occurrence.
That's alright. If you want to cleanup the pull request you can edit your git history locally, for instance you can squash all the commits into one and |
If this latest version looks good to you, @diml , I'll merge all the commits together to clean things up (I'm not a big fan of rewriting repository history -- next time I'll do all my development on a branch and then apply the full diff to |
I'm still dubious about the use of regular expressions and module Win32 = struct
...
let dir_sep = "\\"
let is_dir_sep s i = let c = s.[i] in c = '/' || c = '\\' || c = ':' The
I agree it's not good to rewrite the history of a public repo, but in case of github pull request it is considered good practice AFAIK. If you do the dev on a branch and then apply the diff to master you'll have to create a new pull request. |
I respecfully disagree.
Okay. If what I've done follows good practice, I'll keep doing it. :) |
Actually, |
Wow. The I went back to see what functions are available for moving up and down a directory path (i.e. something like |
I agree some changes are required to TBH the main reason I'm reluctant to depend on I'm fine with this patch if we can avoid using |
I agree, I didn't like loading |
OK, looks good. Do you want to merge the commits together before it is merged? |
I need to verify that this is actually working. I know the |
directories reside. It does this by assuming the "include" and "lib" portions are always at the end and concatenating a relative path to get to the other. This works well in most cases. However PKGSRC has an instance where this isn't true. This patch finds the "include" and "lib" portions within the path and replaces them. This keeps it backwards compatible, but adds PKGSRC support.
platforms, this patch adds the base directory used by PKGSRC to discover.ml's search path.
Okay, this patch is working on NetBSD. I merged the commits into two: the first fixes the C_INCLUDE_PATH computation and the other adds |
Fixes discover.ml to support platforms that use PKGSRC
Thanks! |
This patch tries to add support for PKGSRC in
discover.ml
's search path algorithm. PKGSRC installslibev
files in/usr/pkg/include/ev
and/usr/pkg/lib/ev
. The version ofdiscover.ml
prior to this would compute the library path to be/usr/pkg/include/ev/../lib
, which is wrong.