Skip to content

Make the engines' C sources from 51degrees-cxx 4.5.100 - #22

Merged
drasmart merged 4 commits into
mainfrom
feature/cxx-sources
Nov 2, 2026
Merged

drasmart merged 4 commits into
mainfrom
feature/cxx-sources

Conversation

@drasmart

@drasmart drasmart commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

The engines now compile C sources made from 51degrees-cxx 4.5.100, pinned as the cxx submodule. Before, they were made from the C repositories' main branches, whichever commit that was on the night.

Three commits, best reviewed one at a time:

  1. The cxx submodule and ci/update-amalgamation.ps1. The script makes each engine's .c and .h file from cxx/ with ci/amalgamate.awk, and writes the cxx version at the top of each file. ci/build-project.ps1 runs it with -Check, so a pull request fails if the committed files don't match cxx/.
  2. The regenerated files. This brings in every C change since the engines last took one, including those listed for 4.5.98 and 4.5.100: an IPv4-mapped address is looked up as its IPv4 address, an address below the lowest key gets no value, and a reload that fails keeps the data set in use. .gitattributes keeps the files' line endings as the C sources have them, so a file made on Windows is the same as one made on Linux.
  3. mangle.h replaced by the list in 51degrees-cxx. IP Intelligence's copy of the common C library is renamed with src/common/ipiSymbols.h, checked by 51degrees-cxx's own CI, instead of a list kept by hand here.

Checked locally on Windows: the Device Detection and IP Intelligence unit tests pass, and the mixed example links both engines into one program, with 229 renamed functions.

The reload fixes carried over from the old repositories (#2, #5, #6, #7, #14 to #17) are only safe on 4.5.100 or later, so they come after this.

…es the C sources from it

Each engine compiles one amalgamated .c and .h file, which used to be made
from the C repositories' main branches. They are now made from the cxx
submodule with ci/update-amalgamation.ps1, and the build checks that the
committed files match it.
Generated with ci/update-amalgamation.ps1. The sources the engines compiled
until now came from the C repositories' main branches before 51degrees-cxx
4.5.96, so this brings in every change since, including those listed for
4.5.98 and 4.5.100: an IPv4-mapped address is looked up as its IPv4
address, an address below the lowest key gets no value, and a reload that
fails keeps the data set in use.

The generated files keep the line endings of the C sources, so
.gitattributes stops git from converting them.
Device Detection and IP Intelligence each compile their own copy of the
common C library, so a program that uses both needs one copy's names
changed. mangle.h kept that list by hand. 51degrees-cxx now keeps the same
list in src/common/ipiSymbols.h, checked by its own CI, and applies it when
FIFTYONE_DEGREES_IPI_SYMBOLS is defined.
The example looks for the Lite data file by searching nearby folders, and
now finds cxx/device-detection-data first. CI doesn't fetch Git LFS files,
so that copy is only a pointer.
@drasmart
drasmart merged commit e90c8d0 into main Nov 2, 2026
1 check passed
@drasmart
drasmart deleted the feature/cxx-sources branch November 2, 2026 15:28
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.

1 participant