Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 10 additions & 12 deletions derivations/pebble-sdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
let
libpebble2 = python3.pkgs.buildPythonPackage {
pname = "libpebble2";
version = "0.0.30";
version = "0.0.31";
src = fetchFromGitHub {
owner = "pebble-dev";
repo = "libpebble2";
rev = "6d0e8cffca29eb2ed4a876ea87c50df9c31ad3e7";
hash = "sha256-jzN3bMp7hCCFP6wQ4woXTgOmehczvn7cLqen9TlG7Dc=";
rev = "b7013d01bd6f6d10f7528fcf9557591d5e8cbb3a";
hash = "sha256-4waUs0QeMI0dWL5Dk1HwL/5pK2uOfCFyJaK1MuRkuBw=";
};

propagatedBuildInputs = with python3.pkgs; [
Expand Down Expand Up @@ -88,13 +88,13 @@ in
assert lib.asserts.assertMsg (!withAplite) "aplite is not supported yet";
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "pebble-sdk";
version = "4.9.116";
version = "4.9.124";

src = fetchFromGitHub {
owner = "coredevices";
repo = "PebbleOS";
tag = "v${finalAttrs.version}";
hash = "sha256-ZWh8vIJ+y97z2jz8dtsuE7cJAwjRuORt7jhLCOvVGh4=";
hash = "sha256-EzVMjj17+uLBqee8NgJxRp6giu0RW7wAvGvm5R8V8bw=";
fetchSubmodules = true;
};

Expand All @@ -110,9 +110,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
which
patchelf
]
++ lib.optionals (stdenvNoCC.hostPlatform.system == "x86_64-linux") [
pkgs.gcc_multi
];
++ lib.optional stdenvNoCC.isLinux pkgs.gcc_multi
++ lib.optional stdenvNoCC.isDarwin pkgs.gcc;

patches = [
./patches/skip-tool-check.patch
Expand All @@ -121,9 +120,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
./patches/skip-npm-install.patch
./patches/fix-libpebble-determinism.patch
./patches/fix-asm-debug-prefix-map.patch
]
++ lib.optionals (stdenvNoCC.hostPlatform.system == "x86_64-linux") [
./patches/use-gcc-multi-32bit.patch
./patches/fix-32bit.patch
./patches/fix-rand32-call.patch
];

postPatch = ''
Expand All @@ -134,7 +132,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
'';

hardeningDisable = [
"zerocallusedregs"
"fortify"
];

preBuild = ''
Expand Down
19 changes: 19 additions & 0 deletions derivations/pebble-sdk/patches/fix-32bit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/wscript
+++ b/wscript
@@ -662,8 +662,13 @@ def configure(conf):
Logs.pprint('CYAN', 'Configuring 32 bit host environment')
# Copy 'local' to serve as the basis for '32bit':
env_32bit = conf.env.derive().detach()
- env_32bit.append_value('CFLAGS', '-m32')
- env_32bit.append_value('LINKFLAGS', '-m32')
- env_32bit.LINK_CC = 'gcc'
+ if sys.platform.startswith('linux'):
+ env_32bit.append_value('CFLAGS', '-m32')
+ env_32bit.append_value('LINKFLAGS', '-m32')
+ env_32bit.LINK_CC = 'gcc'
+ env_32bit.append_value('CFLAGS', '-O2')
+ env_32bit.append_value('CFLAGS', '-Wno-error=stringop-truncation')
+ env_32bit.CC = 'gcc'
+ env_32bit.CXX = 'g++'
conf.all_envs['32bit'] = env_32bit
conf.set_env(prev_env)
9 changes: 9 additions & 0 deletions derivations/pebble-sdk/patches/fix-rand32-call.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/src/libutil/platform.c
+++ b/src/libutil/platform.c
@@ -30,5 +30,5 @@ WEAK NORETURN util_assertion_failed(const char *filename, int line) {
}

WEAK uint32_t rand32(void) {
- return ((uint32_t)rand() << 1) + (uint32_t)rand;
+ return ((uint32_t)rand() << 1) + (uint32_t)rand();
}
276 changes: 1 addition & 275 deletions derivations/pebble-sdk/patches/gitinfo-version.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,278 +38,4 @@
- # Force include patch as 0 if it doesn't exist.
patch_verbose = str(version[2])
str_after_patch = version[3]
if (str_after_patch):
--- a/platform/asterix/boot/waftools/gitinfo.py
+++ b/platform/asterix/boot/waftools/gitinfo.py
@@ -1,34 +1,23 @@
# SPDX-FileCopyrightText: 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0

+import os
import re

import waflib.Context
import waflib.Logs

def get_git_revision(ctx):
- commit = ctx.cmd_and_log(['git', 'rev-parse', '--short', 'HEAD'], quiet=waflib.Context.BOTH).strip()
- timestamp = ctx.cmd_and_log(['git', 'log', '-1', '--format=%ct', 'HEAD'], quiet=waflib.Context.BOTH).strip()
+ tag = os.environ.get("PEBBLE_GIT_TAG", "v0.0.0")
+ commit = os.environ.get("PEBBLE_GIT_COMMIT", "nix")
+ timestamp = os.environ.get("PEBBLE_GIT_TIMESTAMP", "0")

- try:
- tag = ctx.cmd_and_log(['git', 'describe'], quiet=waflib.Context.BOTH).strip()
- except Exception:
- tag = "v9.9.9-dev"
- waflib.Logs.warn(f'Git tag not found, using {tag}')
-
- # Validate that git tag follows the required form:
- # See https://github.com/pebble/tintin/wiki/Firmware,-PRF-&-Bootloader-Versions
- # Note: version_regex.groups() returns sequence ('0', '0', '0', 'suffix'):
version_regex = re.search(r"^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
if not version_regex:
raise ValueError(f'Invalid tag: {tag}')

- # Get version numbers from version_regex.groups() sequence and replace None values with 0
- # e.g. v2-beta11 => ('2', None, None, 'beta11') => ('2', '0', '0')
version = [x if x else '0' for x in version_regex.groups()]

- # Used for pebble_pipeline payload, generate a string that contains everything after minor.
- # Force include patch as 0 if it doesn't exist.
patch_verbose = str(version[2])
str_after_patch = version[3]
if (str_after_patch):
--- a/platform/robert/boot/waftools/gitinfo.py
+++ b/platform/robert/boot/waftools/gitinfo.py
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0

+import os
import re

import waflib.Context
@@ -8,30 +9,26 @@


def get_git_revision(ctx):
- try:
- tag = ctx.cmd_and_log(['git', 'describe'], quiet=waflib.Context.BOTH).strip()
- commit = ctx.cmd_and_log(['git', 'rev-parse', '--short', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- timestamp = ctx.cmd_and_log(['git', 'log', '-1', '--format=%ct', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- except Exception:
- waflib.Logs.warn('get_git_version: unable to determine git revision')
- tag, commit, timestamp = ("?", "?", "1")
- # Validate that git tag follows the required form:
- # See https://github.com/pebble/tintin/wiki/Firmware,-PRF-&-Bootloader-Versions
- # Note: version_regex.groups() returns sequence ('0', '0', '0', 'suffix'):
- version_regex = re.search("^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
- if version_regex:
- # Get version numbers from version_regex.groups() sequence and replace None values with 0
- # e.g. v2-beta11 => ('2', None, None, 'beta11') => ('2', '0', '0')
- version = [x if x else '0' for x in version_regex.groups()[:3]]
- else:
- waflib.Logs.warn('get_git_revision: Invalid git tag! '
- 'Must follow this form: `v0[.0[.0]][-suffix]`')
- version = ['0', '0', '0', 'unknown']
+ tag = os.environ.get("PEBBLE_GIT_TAG", "v0.0.0")
+ commit = os.environ.get("PEBBLE_GIT_COMMIT", "nix")
+ timestamp = os.environ.get("PEBBLE_GIT_TIMESTAMP", "0")
+
+ version_regex = re.search(r"^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
+ if not version_regex:
+ raise ValueError(f'Invalid tag: {tag}')
+
+ version = [x if x else '0' for x in version_regex.groups()]
+
+ patch_verbose = str(version[2])
+ str_after_patch = version[3]
+ if (str_after_patch):
+ patch_verbose += '-' + str_after_patch
+
return {'TAG': tag,
'COMMIT': commit,
'TIMESTAMP': timestamp,
'MAJOR_VERSION': version[0],
'MINOR_VERSION': version[1],
- 'PATCH_VERSION': version[2]}
+ 'PATCH_VERSION': version[2],
+ 'MAJOR_MINOR_PATCH_STRING' : ".".join(version[0:3]),
+ "PATCH_VERBOSE_STRING": patch_verbose}
--- a/platform/silk/boot/waftools/gitinfo.py
+++ b/platform/silk/boot/waftools/gitinfo.py
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0

+import os
import re

import waflib.Context
@@ -8,30 +9,26 @@


def get_git_revision(ctx):
- try:
- tag = ctx.cmd_and_log(['git', 'describe'], quiet=waflib.Context.BOTH).strip()
- commit = ctx.cmd_and_log(['git', 'rev-parse', '--short', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- timestamp = ctx.cmd_and_log(['git', 'log', '-1', '--format=%ct', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- except Exception:
- waflib.Logs.warn('get_git_version: unable to determine git revision')
- tag, commit, timestamp = ("?", "?", "1")
- # Validate that git tag follows the required form:
- # See https://github.com/pebble/tintin/wiki/Firmware,-PRF-&-Bootloader-Versions
- # Note: version_regex.groups() returns sequence ('0', '0', '0', 'suffix'):
- version_regex = re.search("^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
- if version_regex:
- # Get version numbers from version_regex.groups() sequence and replace None values with 0
- # e.g. v2-beta11 => ('2', None, None, 'beta11') => ('2', '0', '0')
- version = [x if x else '0' for x in version_regex.groups()[:3]]
- else:
- waflib.Logs.warn('get_git_revision: Invalid git tag! '
- 'Must follow this form: `v0[.0[.0]][-suffix]`')
- version = ['0', '0', '0', 'unknown']
+ tag = os.environ.get("PEBBLE_GIT_TAG", "v0.0.0")
+ commit = os.environ.get("PEBBLE_GIT_COMMIT", "nix")
+ timestamp = os.environ.get("PEBBLE_GIT_TIMESTAMP", "0")
+
+ version_regex = re.search(r"^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
+ if not version_regex:
+ raise ValueError(f'Invalid tag: {tag}')
+
+ version = [x if x else '0' for x in version_regex.groups()]
+
+ patch_verbose = str(version[2])
+ str_after_patch = version[3]
+ if (str_after_patch):
+ patch_verbose += '-' + str_after_patch
+
return {'TAG': tag,
'COMMIT': commit,
'TIMESTAMP': timestamp,
'MAJOR_VERSION': version[0],
'MINOR_VERSION': version[1],
- 'PATCH_VERSION': version[2]}
+ 'PATCH_VERSION': version[2],
+ 'MAJOR_MINOR_PATCH_STRING' : ".".join(version[0:3]),
+ "PATCH_VERBOSE_STRING": patch_verbose}
--- a/platform/snowy/boot/waftools/gitinfo.py
+++ b/platform/snowy/boot/waftools/gitinfo.py
@@ -1,34 +1,33 @@
# SPDX-FileCopyrightText: 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0

+import os
import re

import waflib.Context
import waflib.Logs

def get_git_revision(ctx):
- try:
- tag = ctx.cmd_and_log(['git', 'describe'], quiet=waflib.Context.BOTH).strip()
- commit = ctx.cmd_and_log(['git', 'rev-parse', '--short', 'HEAD'], quiet=waflib.Context.BOTH).strip()
- timestamp = ctx.cmd_and_log(['git', 'log', '-1', '--format=%ct', 'HEAD'], quiet=waflib.Context.BOTH).strip()
- except Exception:
- waflib.Logs.warn('get_git_version: unable to determine git revision')
- tag, commit, timestamp = ("?", "?", "1")
- # Validate that git tag follows the required form:
- # See https://github.com/pebble/tintin/wiki/Firmware,-PRF-&-Bootloader-Versions
- # Note: version_regex.groups() returns sequence ('0', '0', '0', 'suffix'):
- version_regex = re.search("^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
- if version_regex:
- # Get version numbers from version_regex.groups() sequence and replace None values with 0
- # e.g. v2-beta11 => ('2', None, None, 'beta11') => ('2', '0', '0')
- version = [x if x else '0' for x in version_regex.groups()[:3]]
- else:
- waflib.Logs.warn('get_git_revision: Invalid git tag! '
- 'Must follow this form: `v0[.0[.0]][-suffix]`')
- version = ['0', '0', '0', 'unknown']
+ tag = os.environ.get("PEBBLE_GIT_TAG", "v0.0.0")
+ commit = os.environ.get("PEBBLE_GIT_COMMIT", "nix")
+ timestamp = os.environ.get("PEBBLE_GIT_TIMESTAMP", "0")
+
+ version_regex = re.search(r"^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
+ if not version_regex:
+ raise ValueError(f'Invalid tag: {tag}')
+
+ version = [x if x else '0' for x in version_regex.groups()]
+
+ patch_verbose = str(version[2])
+ str_after_patch = version[3]
+ if (str_after_patch):
+ patch_verbose += '-' + str_after_patch
+
return {'TAG': tag,
'COMMIT': commit,
'TIMESTAMP': timestamp,
'MAJOR_VERSION': version[0],
'MINOR_VERSION': version[1],
- 'PATCH_VERSION': version[2]}
+ 'PATCH_VERSION': version[2],
+ 'MAJOR_MINOR_PATCH_STRING' : ".".join(version[0:3]),
+ "PATCH_VERBOSE_STRING": patch_verbose}
--- a/platform/tintin/boot/waftools/gitinfo.py
+++ b/platform/tintin/boot/waftools/gitinfo.py
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0

+import os
import re

import waflib.Context
@@ -8,30 +9,26 @@


def get_git_revision(ctx):
- try:
- tag = ctx.cmd_and_log(['git', 'describe'], quiet=waflib.Context.BOTH).strip()
- commit = ctx.cmd_and_log(['git', 'rev-parse', '--short', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- timestamp = ctx.cmd_and_log(['git', 'log', '-1', '--format=%ct', 'HEAD'],
- quiet=waflib.Context.BOTH).strip()
- except Exception:
- waflib.Logs.warn('get_git_version: unable to determine git revision')
- tag, commit, timestamp = ("?", "?", "1")
- # Validate that git tag follows the required form:
- # See https://github.com/pebble/tintin/wiki/Firmware,-PRF-&-Bootloader-Versions
- # Note: version_regex.groups() returns sequence ('0', '0', '0', 'suffix'):
- version_regex = re.search("^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
- if version_regex:
- # Get version numbers from version_regex.groups() sequence and replace None values with 0
- # e.g. v2-beta11 => ('2', None, None, 'beta11') => ('2', '0', '0')
- version = [x if x else '0' for x in version_regex.groups()[:3]]
- else:
- waflib.Logs.warn('get_git_revision: Invalid git tag! '
- 'Must follow this form: `v0[.0[.0]][-suffix]`')
- version = ['0', '0', '0', 'unknown']
+ tag = os.environ.get("PEBBLE_GIT_TAG", "v0.0.0")
+ commit = os.environ.get("PEBBLE_GIT_COMMIT", "nix")
+ timestamp = os.environ.get("PEBBLE_GIT_TIMESTAMP", "0")
+
+ version_regex = re.search(r"^v(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:(?:-)(.+))?$", tag)
+ if not version_regex:
+ raise ValueError(f'Invalid tag: {tag}')
+
+ version = [x if x else '0' for x in version_regex.groups()]
+
+ patch_verbose = str(version[2])
+ str_after_patch = version[3]
+ if (str_after_patch):
+ patch_verbose += '-' + str_after_patch
+
return {'TAG': tag,
'COMMIT': commit,
'TIMESTAMP': timestamp,
'MAJOR_VERSION': version[0],
'MINOR_VERSION': version[1],
- 'PATCH_VERSION': version[2]}
+ 'PATCH_VERSION': version[2],
+ 'MAJOR_MINOR_PATCH_STRING' : ".".join(version[0:3]),
+ "PATCH_VERBOSE_STRING": patch_verbose}
if (str_after_patch):
15 changes: 0 additions & 15 deletions derivations/pebble-sdk/patches/use-gcc-multi-32bit.patch

This file was deleted.

Loading