From 840c863786cb91c83f2e815a932fe218cf8f43af Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Thu, 10 Apr 2025 16:25:08 -0400 Subject: Fix Darwin version reporting for older macOS --- src/bug_report.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bug_report.cpp') diff --git a/src/bug_report.cpp b/src/bug_report.cpp index c44c4be33..0a617fe39 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -527,7 +527,7 @@ gb_internal void report_os_info() { #elif defined(GB_SYSTEM_OSX) gbString sw_vers = gb_string_make(heap_allocator(), ""); - if (!system_exec_command_line_app_output("sw_vers --productVersion", &sw_vers)) { + if (!system_exec_command_line_app_output("sw_vers -productVersion", &sw_vers)) { gb_printf("macOS Unknown\n"); return; } -- cgit v1.2.3 From ed56a7ca102339d2b711ec5ca9529a02bd621a7b Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Tue, 13 May 2025 18:09:30 +0200 Subject: Parse odin version date out of HEAD commit if available --- build.bat | 44 +++++++++++++++++++------------------------- build_odin.sh | 8 ++++++-- misc/get-date.c | 2 +- src/bug_report.cpp | 8 +++++++- 4 files changed, 33 insertions(+), 29 deletions(-) (limited to 'src/bug_report.cpp') diff --git a/build.bat b/build.bat index ae733ff2a..b1ff9b173 100644 --- a/build.bat +++ b/build.bat @@ -19,16 +19,27 @@ if "%VSCMD_ARG_TGT_ARCH%" neq "x64" ( ) ) +where /Q git.exe || goto skip_git_hash +if not exist .git\ goto skip_git_hash +for /f "tokens=1,2" %%i IN ('git show "--pretty=%%cd %%h" "--date=format:%%Y-%%m-%%d" --no-patch --no-notes HEAD') do ( + set CURR_DATE_TIME=%%i + set GIT_SHA=%%j +) +if %ERRORLEVEL% equ 0 ( + goto have_git_hash_and_date +) +:skip_git_hash pushd misc cl /nologo get-date.c -popd - -for /f %%i in ('misc\get-date') do ( +for /f %%i in ('get-date') do ( set CURR_DATE_TIME=%%i + rem Don't set GIT_SHA ) +popd +:have_git_hash_and_date set curr_year=%CURR_DATE_TIME:~0,4% -set curr_month=%CURR_DATE_TIME:~4,2% -set curr_day=%CURR_DATE_TIME:~6,2% +set curr_month=%CURR_DATE_TIME:~5,2% +set curr_day=%CURR_DATE_TIME:~8,2% :: Make sure this is a decent name and not generic set exe_name=odin.exe @@ -61,31 +72,14 @@ if %release_mode% equ 0 ( set V4=0 set odin_version_full="%V1%.%V2%.%V3%.%V4%" set odin_version_raw="dev-%V1%-%V2%" - set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF rem Parse source code as utf-8 even on shift-jis and other codepages rem See https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 set compiler_flags= %compiler_flags% /utf-8 -set compiler_defines= -DODIN_VERSION_RAW=\"%odin_version_raw%\" +set compiler_defines= -DODIN_VERSION_RAW=\"%odin_version_raw%\" -DGIT_SHA=\"%GIT_SHA%\" rem fileversion is defined as {Major,Minor,Build,Private: u16} so a bit limited -set rc_flags=-nologo ^ --DV1=%V1% -DV2=%V2% -DV3=%V3% -DV4=%V4% ^ --DVF=%odin_version_full% -DNIGHTLY=%nightly% - -where /Q git.exe || goto skip_git_hash -if not exist .git\ goto skip_git_hash -for /f "tokens=1,2" %%i IN ('git show "--pretty=%%cd %%h" "--date=format:%%Y-%%m" --no-patch --no-notes HEAD') do ( - set odin_version_raw=dev-%%i - set GIT_SHA=%%j -) -if %ERRORLEVEL% equ 0 ( - set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\" - set rc_flags=%rc_flags% -DGIT_SHA=%GIT_SHA% -DVP=%odin_version_raw%:%GIT_SHA% -) else ( - set rc_flags=%rc_flags% -DVP=%odin_version_raw% -) -:skip_git_hash +set rc_flags="-DGIT_SHA=%GIT_SHA% -DVP=dev-%V1%-%V2%:%GIT_SHA% nologo -DV1=%V1% -DV2=%V2% -DV3=%V3% -DV4=%V4% -DVF=%odin_version_full% -DNIGHTLY=%nightly%" if %nightly% equ 1 set compiler_defines=%compiler_defines% -DNIGHTLY @@ -153,4 +147,4 @@ if %release_mode% EQU 0 echo: & echo Debug compiler built. Note: run "build.bat del *.obj > NUL 2> NUL -:end_of_build +:end_of_build \ No newline at end of file diff --git a/build_odin.sh b/build_odin.sh index 19bb82a11..7bbe82ba1 100755 --- a/build_odin.sh +++ b/build_odin.sh @@ -6,7 +6,6 @@ set -eu : ${LDFLAGS=} : ${LLVM_CONFIG=} -CPPFLAGS="$CPPFLAGS -DODIN_VERSION_RAW=\"dev-$(date +"%Y-%m")\"" CXXFLAGS="$CXXFLAGS -std=c++14" DISABLED_WARNINGS="-Wno-switch -Wno-macro-redefined -Wno-unused-value" LDFLAGS="$LDFLAGS -pthread -lm" @@ -15,8 +14,12 @@ OS_NAME="$(uname -s)" if [ -d ".git" ] && [ -n "$(command -v git)" ]; then GIT_SHA=$(git show --pretty='%h' --no-patch --no-notes HEAD) + GIT_DATE=$(git show "--pretty=%cd" "--date=format:%Y-%m" --no-patch --no-notes HEAD) CPPFLAGS="$CPPFLAGS -DGIT_SHA=\"$GIT_SHA\"" +else + GIT_DATE=$(date +"%Y-%m") fi +CPPFLAGS="$CPPFLAGS -DODIN_VERSION_RAW=\"dev-$GIT_DATE\"" error() { printf "ERROR: %s\n" "$1" @@ -158,7 +161,8 @@ build_odin() { } run_demo() { - ./odin run examples/demo -vet -strict-style -- Hellope World + #./odin run examples/demo -vet -strict-style -- Hellope World + ./odin report } if [ $# -eq 0 ]; then diff --git a/misc/get-date.c b/misc/get-date.c index bf5b32738..b3eb1be78 100644 --- a/misc/get-date.c +++ b/misc/get-date.c @@ -9,5 +9,5 @@ int main(int arg_count, char const **arg_ptr) { time_t t = time(NULL); struct tm* now = localtime(&t); - printf("%04d%02d%02d", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday); + printf("%04d-%02d-%02d", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday); } \ No newline at end of file diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 0a617fe39..32210c23e 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -667,8 +667,14 @@ gb_internal void print_bug_report_help() { gb_printf("-nightly"); #endif + String version = {}; + #ifdef GIT_SHA - gb_printf(":%s", GIT_SHA); + version.text = cast(u8 *)GIT_SHA; + version.len = gb_strlen(GIT_SHA); + if (version != "") { + gb_printf(":%.*s", LIT(version)); + } #endif gb_printf("\n"); -- cgit v1.2.3 From 144daf6fff0703b8d3336e5aa012cc0c2e6b3170 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sat, 14 Jun 2025 00:27:37 +0200 Subject: add macOS Tahoe to `odin report` and `core:sys/info` --- core/sys/info/platform_darwin.odin | 1 + src/bug_report.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src/bug_report.cpp') diff --git a/core/sys/info/platform_darwin.odin b/core/sys/info/platform_darwin.odin index 7dc49bcd1..dd7f0fa03 100644 --- a/core/sys/info/platform_darwin.odin +++ b/core/sys/info/platform_darwin.odin @@ -34,6 +34,7 @@ init_platform :: proc() { } else { os_version.platform = .MacOS switch version.majorVersion { + case 26: ws(&b, "macOS Tahoe") case 15: ws(&b, "macOS Sequoia") case 14: ws(&b, "macOS Sonoma") case 13: ws(&b, "macOS Ventura") diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 32210c23e..98a376895 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -540,6 +540,7 @@ gb_internal void report_os_info() { } switch (major) { + case 26: gb_printf("macOS Tahoe"); break; case 15: gb_printf("macOS Sequoia"); break; case 14: gb_printf("macOS Sonoma"); break; case 13: gb_printf("macOS Ventura"); break; -- cgit v1.2.3