Skip to content

Conversation

@alandefreitas
Copy link
Member

The previous jamfile was counting on the git layout instead of the boost release layout. We can replicate the error with b2 libs/utility/doc from <boost root>, which still tries to generate the doc in <boost root>/libs/utility/doc/html and <boost root>/bin.v2/libs/utility/doc/html still keeps temporary files, but it fails to find the links.

According to Peter, we should use path-constant instead of hardcoding relative paths in the jamfile. The reason is relative paths are often but not always relative to the Jamfile location. This PR uses BOOST_ROOT from Jamroot. b2 libs/utility/b2 libs/utility/doc work from <boost root> now (locally).

What's funny is b2 libs/core/doc works with both layouts and boost.utility uses almost the same commands script.

@Lastique
Copy link
Member

Lastique commented Dec 8, 2021

Don't do unnecessary glob.

@cppalliance-bot
Copy link

@alandefreitas
Copy link
Member Author

Oops... I was trying to ensure it looked exactly like boost.core and left that behind. The new version also worked locally.

@Lastique Lastique merged commit c21d281 into boostorg:develop Dec 8, 2021
@Lastique
Copy link
Member

Lastique commented Dec 8, 2021

This broke styling and links to images in my local build.

@alandefreitas
Copy link
Member Author

@Lastique
Copy link
Member

Lastique commented Dec 8, 2021

The problem is it generates links such as <link rel="stylesheet" href="..//home/lastique/src/boost/doc/src/boostbook.css" type="text/css"> in html files. Sorry, I'm reverting this.

@alandefreitas
Copy link
Member Author

I'll look for a solution that works directly on the docker images then.

@Lastique
Copy link
Member

Lastique commented Dec 8, 2021

Other libraries seem to work fine with relative paths, so it seems they should work for Boost.Utility as well. At least, it isn't clear what's the difference between the system where the official docs are built and our local systems.

@alandefreitas
Copy link
Member Author

alandefreitas commented Dec 8, 2021

Other libraries seem to work fine with relative paths, so it seems they should work for Boost.Utility as well.

Exactly.

Apart from the glob, there's almost no difference between boost.utility and boost.core.

According to Peter, we should never use relative paths in a Jamfile. This implies that boost.core was just lucky. But it's not the only library where we see relative paths.

And we already replicated the error by running it from the root path, so I don't think the docker image will help much, even though I'll keep trying.

@pdimov
Copy link
Member

pdimov commented Dec 8, 2021

I have no idea what's going on here; the PR says "use path-constant" but doesn't use path-constant but BOOST_ROOT.

@alandefreitas
Copy link
Member Author

I have no idea what's going on here; the PR says "use path-constant" but doesn't use path-constant but BOOST_ROOT.
Delete branch

I might have completely misunderstood what you said then. I'm so sorry. Isn't BOOST_ROOT a path-constant? I imagined if we defined the path-constant in our own Jamfile instead of just using a path-constant defined somewhere else, then the new solution would be as hard-coded as before.

I probably misunderstood you then. It didn't work anyway.

@pdimov
Copy link
Member

pdimov commented Dec 8, 2021

Use the path-constant b2 rule to define a variable for the path you want, like it's done for example in this Jamfile: https://github.com/boostorg/boostdep/blob/037705e21b297b28c77663d7cc1cd28cb7a240c5/test/Jamfile#L8-L9

Since your Jamfile is in libs/utility/doc, you can for instance use path-constant INCLUDE : ../include ; and then use $(INCLUDE)/boost/utility/value_init.hpp to reference value_init.hpp. Or you can use path-constant INCLUDE : ../include/boost/utility ; and then $(INCLUDE)/value_init.hpp. And so on.

path-constant takes a path relative to the current Jamfile, converts it into absolute path, and sets the variable to that.

@Lastique
Copy link
Member

Lastique commented Dec 8, 2021

I've pushed 9d1284e that works for me locally. I think, this is what Peter meant.

The important difference from this PR is that boost.root parameter needs to stay relative to the Jamfile.

@alandefreitas
Copy link
Member Author

So...

path-constant VALUE : ../../.. ;
$(VALUE)/boost/utility/base_from_member.hpp

is different from

../../../boost/utility/base_from_member.hpp

? 😓

@pdimov
Copy link
Member

pdimov commented Dec 8, 2021

Sometimes, yes. Most parts of b2 (all of the built-in rules, for instance) interpret a relative path as relative to the current Jamfile. However, other parts of it interpret it relative to the current directory. (E.g. the path.glob rule.)

In addition, if you pass the relative path as-is to an external program, the external program will again interpret it against the current directory.

It's safest to use path-constant variables because these are unambiguously interpreted to be relative to the current Jamfile.

It is what it is.

@Lastique
Copy link
Member

Lastique commented Dec 9, 2021

Looks like 9d1284e did the trick. Can we update the website?

@glenfe
Copy link
Member

glenfe commented Dec 9, 2021

Yes, @alandefreitas please create pull request to https://github.com/boostorg/website/tree/master/doc/libs for 1_78_0/libs/utility with the correct generated content

@alandefreitas
Copy link
Member Author

Oh... website/doc/libs/ is meant to override content? I always wondered why there were only a few libraries in there. 😆

@alandefreitas
Copy link
Member Author

It should have the same layout as https://www.boost.org/doc/libs/1_78_0/libs/utility/doc/html/, right?

That is, https://www.boost.org/doc/libs/1_78_0/libs/utility/doc/html/index.html should go into website/doc/libs/1_78_0/libs/utility/doc/html/index.html, right?

@glenfe
Copy link
Member

glenfe commented Dec 9, 2021

Yes, see the other directories for examples

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.

5 participants