Commit graph

29 commits

Author SHA1 Message Date
Yucong Sun
897821731f
build: stop autogen churn -- pin generator versions, gate copy-back on input hash (#1263)
Every local build regenerated grammar.autogen.cc/.h and lexer.autogen.cc
and copied them back into the source tree, churning git whenever the
host's bison/flex emitted cosmetically different output than whatever
produced the committed copy. The existing normalization only tokenized
paths and header guards; it could not help when two generators that even
REPORT the same version (3.8.2) differ in emitted code (the committed
grammar had a distro-patched bison's "int yynerrs YY_ATTRIBUTE_UNUSED;"
that vanilla 3.8.2 downgrades on every rebuild).

Two-layer fix:
- Version pin: the committed generated files record the generator that
  produced them ("made by GNU Bison X.Y.Z", YY_FLEX_*_VERSION). A host
  with an OLDER generator no longer regenerates at all -- it builds from
  the committed copy via the existing pre-generated path. Hosts at/above
  the pin still regenerate, so CI keeps validating grammar.y/lexer.l
  against a real toolchain.
- Input-hash gate: the post-build copy-back stamps the committed file
  with the sha256 of its INPUT (grammar.y / lexer.l) and is skipped
  entirely while that hash is unchanged. Generator differences alone can
  no longer touch the committed files; editing the .y/.l still updates
  them exactly as before.

Also: the copy-back now skips writing byte-identical content, so it no
longer bumps mtimes and cascades pointless relinks on every build.

The three committed autogen files are re-stamped in this commit (one-time
churn) as the new pinned baseline: bison 3.8.2 / flex 2.6.4, matching
every CI image.


Claude-Session: https://claude.ai/code/session_01PCUi8QKaFxeTyLXMeVkqn4

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-13 19:18:26 -05:00
Yucong Sun
5e04adbb1d Tokenize build dir as $BUILD_ROOT$ in checked-in scanner/parser
The committed *.autogen.* files embedded the generating build
directory's name in #line markers (build/ vs build-rel/), so building
from different build trees churned them. NORMALIZE/DENORMALIZE now
tokenize the build root alongside $REPO_ROOT$; regenerated copies are
byte-identical across build directories.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
d1951b8671
Add Windows dev environment, agent guide, and doc overhaul (#1208)
* Add cross-platform VSCode config, agent guide, and doc overhaul

CMake / build:
- Add CMakePresets.json: platform-aware configure presets for Linux, macOS,
  and Windows (MSYS2/MinGW64); generator and env are now preset-driven
- Fix cmake/util.cmake NORMALIZE: also replace Bison-generated header guard
  (mangled absolute build path → stable YY_YY_GRAMMAR_AUTOGEN_H_INCLUDED)
- Move driver-testsuite and driver-autotest run targets to root CMakeLists.txt;
  rename driver-fulltest → driver-autotest
- Update grammar.autogen.h with stable platform-independent header guard
- Fix cmake/FindMySQL.cmake: MSYS2/MinGW64 static linking, mariadb_config
  discovery, POSIX-to-native path conversion, --libs_sys for Windows deps
- Add cmake/util.cmake: NORMALIZE/DENORMALIZE for grammar.autogen paths
- Fix src/CMakeLists.txt: use find_program(bash) for .sh build script
- Update grammar.autogen.cc: replace absolute paths with $REPO_ROOT$ tokens

VSCode (.vscode/):
- settings.json: remove hardcoded cmake.generator/cmake.environment (now in
  presets); fix VERBOSE=1 → --verbose; keep MSYS2 terminal profile for Windows
- launch.json: replace hardcoded /mnt/e paths and pipeTransport WSL configs
  with platform-specific configs using windows/osx sections; two configs:
  "driver - testsuite" (interactive) and "driver - autotest" (-ftest)
- tasks.json: cmake build task with platform-correct parallel jobs (nproc /
  sysctl / NUMBER_OF_PROCESSORS); driver-testsuite and driver-autotest run tasks
- .gitignore: ignore auto-generated .vscode/c_cpp_properties.json

Windows development:
- Add open-editor-msys2.bat: auto-detects MSYS2, sets MSYS2_ROOT, launches
  VS Code or Antigravity IDE inside MSYS2 environment
- Add open-editor-wsl.bat: reads WSL distro from UNC path, launches editor
  with --remote wsl+<distro>

Agent guide (AGENTS.md + CLAUDE.md):
- Add AGENTS.md: architecture, package API, memory management, CMake
  constraints, CI matrix, Windows/WSL environment requirements
- CLAUDE.md: import AGENTS.md via @-directive

README overhaul (EN + CN):
- Add three-layer architecture diagram and expanded LPC/Driver/Mudlib sections
- Per-platform build guides with WSL setup flow
- Sync README_CN.md with Chinese translations of all new sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix tasks.json: use nproc, add clean rebuild, fix fulltest target

- Replace %NUMBER_OF_PROCESSORS% with $(nproc) — tasks run in MSYS2 bash
  via the automation profile so the Windows cmd variable never expanded
- Add 'cmake: clean rebuild driver' task using --clean-first flag
- Rename driver-autotest → driver-fulltest to match the CMake target name
- Drop redundant windows/osx command overrides (bash works on all platforms)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Rename VS Code tasks and document them in README

- Rename tasks to driver: build / clean rebuild / testsuite / autotest
- Add VS Code build section to README with task table and kit selection tip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 22:17:37 -07:00
Yucong Sun
19f60be703 Upgrade to latest libevent 2023-06-03 01:19:38 -07:00
lostsnow
f6db69454d
fixes alpine static linking (#814)
* add static linking support for alpine linux

* alpine linux static linking document

* libexecinfo and libdl for backtrace

* fixes clang build with new version of github action build images

* fixes clang build with new version of github action build images
2021-05-25 08:43:35 -07:00
Yucong Sun
fe018690f5 Adding postgresql support 2021-02-26 00:15:25 -08:00
Yucong Sun
a711254676 Fix linking mysql on windows 2021-02-26 00:15:25 -08:00
gesslar
1ec3031b61 Update Findjemalloc.cmake
Correction, line 19 should have been 

`${CMAKE_FIND_LIBRARY_PREFIXES}jemalloc${CMAKE_FIND_LIBRARY_SUFFIXES}`

Confirmed this compiles on centos.
2020-11-17 19:47:51 -08:00
gesslar
23ac098091 Update Findjemalloc.cmake
Compiling in centos (AWS) presents this error when trying to find jemalloc
```
CMake Error at /usr/local/lib64/python3.6/site-packages/cmake/data/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
 Could NOT find jemalloc (missing: JEMALLOC_LIBRARY) (found version
 "5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756")
```

Making this change allows it to compile.
2020-11-15 18:02:45 -08:00
Yucong Sun
5755fcb27f Use GIT hash as version 2020-10-11 18:46:33 -07:00
Yucong Sun
7f2528684a when dynamic linking, ignore dependencies 2020-05-01 09:04:02 -07:00
Yucong Sun
ca6f5d65e1 Fix mysql linking under win32, also auto install libmysql.dll 2020-05-01 09:04:02 -07:00
Yucong Sun
ebdce332c1 Fix warnings for findjemalloc.cmake 2020-05-01 09:04:02 -07:00
Yucong Sun
78523b3d04 Correctly link to jemalloc in static 2020-04-13 23:25:27 -07:00
Yucong Sun
f413395eeb Adding sqlite3 support and db_* efun tests 2020-03-31 20:11:35 -07:00
Yucong Sun
839edf7f31
Fix CI checkes (#573)
* Update ci-windows.yml

* Fix OSX CI build

* Update FindMysql to work with brew install mysql-client

* Avoid reinstalling mingw packages if not needed
2020-01-23 18:15:17 -08:00
Yucong Sun
f60879a29e Bundle crypt funcitons from musl, also fix #455. 2019-11-22 19:36:11 -08:00
Yucong Sun
6ee144fa2e Fix issues detecting libevent2.0 2019-11-16 22:02:10 -08:00
oiuv
d22fa2b1f0 fix bug for Could not find "mysql.h" 2019-10-24 12:53:09 -07:00
Yucong Sun
4715e2a029 Restore correct file permissions 2019-10-23 14:37:30 -07:00
Yucong Sun
7188f667f0 Build support for osx 2019-10-23 13:36:02 -07:00
Yucong Sun
99eb690c9e
more fixes from V2019 (#479)
* Move settings from common.cmake into main cmake files

* Fix #478 and #461

* Update how VERSION is displayed

* Set PUBLIC deps for packages

* Update FindMySQL.cmake
2019-10-21 22:38:10 -07:00
Yucong Sun
c8f24e89b3
Pull latest changes from v2019 (#475)
* Require threads & ICU

* warn about jemalloc being disabled

* #471 include JEMALLOC_MANGLE

* Support using gcrypt for crypt detection
2019-10-08 22:25:56 -07:00
Yucong Sun
ad561df1f1 Support and require USE_JEMALLOC in non debug build 2019-01-17 17:27:41 -08:00
Yucong Sun
c57371f268 use march instead of mtune for maximum performance optimizations 2019-01-15 02:26:00 -08:00
Yucong Sun
adc565e984 Restore mtune=native in Release builds 2019-01-14 22:40:18 -08:00
Yucong Sun
1fe7f7bdef fix crypt 2019-01-14 21:09:29 -08:00
Yucong Sun
b327a775dc
Migrate buildsystem to CMake (#431)
fix #361

* basic functional cmake rules
* Adding missing libraies
* Successfully compiled under cmake
* Make sure .sh always has eol=lf
* final cmake related changes
* Getting rid of autoconf automake and jemalloc
* Move testsuite to top directory
* auto config packages using cmake
* Fix file modes
* basic preprocessor
* Adding portbind back
* Fix travis
* Lower libevent requirement to 2.0
* Restore testsuite/log dir
2019-01-07 20:29:34 -08:00
Yucong Sun
472dd54c5a Some basic cmake 2019-01-01 17:36:54 -08:00