Skip to content

Update submodule sources when building driver #1520

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

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .evergreen/compile-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,19 @@ esac
# Report the current PHP version
echo "PHP: `php --version | head -n 1`"

# If we're testing a specific version of libmongoc, update submodule sources
if [ -n "$LIBMONGOC_VERSION" ]; then
php scripts/update-submodule-sources.php
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below we have a conditional for make libmongoc-version-current. I suppose that still needs to remain separate because phpize is what builds Makefile from Makefile.frag. So, at best, we could move that between the phpize and ./configure lines below.

And on a related note: the LIBMONGOC_VERSION_CURRENT file is actually referenced during ./configure to create the substitutions, so shouldn't we be running make libmongoc-version-current before ./configure? As-is, I don't think the compiled driver reports the correct version info.

Do you want to handle that in this same PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point: LIBMONGOC_VERSION_CURRENT is indeed referenced during ./configure, but we have to run ./configure in order to have the Makefile generated. To avoid that conundrum, I now call phpize and ./configure, then run make libmongoc-version-current before running ./configure again to generate the final Makefile that we're building with. It's a little messy but the only way to work around the issue.

Copy link
Member

@jmikola jmikola Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't complain if you want to just manually run:

cd src/libmongoc/ && python build/calc_release_version.py > ../LIBMONGOC_VERSION_CURRENT

And then you can leave a comment in both places (the Evergreen config and Makefile.frag) indicating that we should update both instances if it needs to change down the line.


phpize
./configure --enable-mongodb-developer-flags

# If we're testing a specific version of libmongoc, regenerate the version file
# configure relies on version information in libmongoc-version-current, but the target is not available until after calling configure
# To work around this, run the make target, then run configure again
if [ -n "$LIBMONGOC_VERSION" ]; then
make libmongoc-version-current
./configure --enable-mongodb-developer-flags
fi

make test TESTS="tests/smoketest.phpt"