diff --git a/docs/recipe-format.md b/docs/recipe-format.md index 3f75a0f..5a52161 100644 --- a/docs/recipe-format.md +++ b/docs/recipe-format.md @@ -40,9 +40,10 @@ The following values are accepted: Name | Meaning --------|------------------------------------------------------------------------- -`rmall` | Packages which work on all reMarkable devices without modification. +`rmall` | Packages which work on all reMarkable devices without modification. These packages must be cpu architecture independent, which generally means that they do not contain binaries, only scripts and configuration files. `rm1` | Packages requiring reMarkable 1-specific resources or compilation flags. `rm2` | Packages requiring reMarkable 2-specific resources or compilation flags. +`rmpp` | Packages requiring reMarkable Paper Pro-specific resources or compilation flags. For example, use `archs=(rm1)` for a package that only works on reMarkable 1, or `archs=(rm1 rm2)` for a package that works both on reMarkable 1 and reMarkable 2 but needs different dependencies or compilation flags for each of those. @@ -230,6 +231,8 @@ Should match the upstream name as closely as possible. The `build()` function runs in the context of a Docker container with the chosen `image`. This function has access to all the metadata variables declared above, plus the `$arch` variable which contains the name of the architecture the recipe is currently being built for. The working directory is `$srcdir`, which is populated with all the sources declared in `sources`. +If you are going to build aarch64 binaries, you must switch to suitable environment variables by sourcing `/opt/x-tools/switch-aarch64.sh`. +If you need to go back to ARMv7, you can source `/opt/x-tools/switch-arm.sh`. ### Package Section diff --git a/pyproject.toml b/pyproject.toml index b9dd286..91deede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,10 @@ [project] name = "toltecmk" -version = "0.3.4" +version = "0.4.0" authors = [ { name="Mattéo Delabre", email="git.matteo@delab.re" }, { name="Eeems", email="eeems@eeems.email" }, + { name="Noa Himesaka", email="himesaka@noa.codes" }, ] description = "Build system used for the Toltec community repository" requires-python = ">=3.11" diff --git a/tests/recipe_parsers/test_installdepends.py b/tests/recipe_parsers/test_installdepends.py index 0d28db4..07d9999 100644 --- a/tests/recipe_parsers/test_installdepends.py +++ b/tests/recipe_parsers/test_installdepends.py @@ -35,7 +35,7 @@ def test_installdepends(self) -> None: with open(path.join(rec_path, "package"), "w") as rec_def_file: rec_def_file.write( """ -archs=(rmall rmallos2 rmallos3 rm1 rm1os2 rm1os3 rm2 rm2os2 rm2os3) +archs=(rmall rmallos2 rmallos3 rm1 rm1os2 rm1os3 rm2 rm2os2 rm2os3 rmpp rmppos3) pkgnames=(toltec-base) pkgdesc="Metapackage defining the base set of packages in a Toltec install" url=https://toltec-dev.org/ @@ -49,6 +49,8 @@ def test_installdepends(self) -> None: installdepends_rm1os3=(open-remarkable-shutdown) installdepends_rm2os2=(rm2-suspend-fix) installdepends_rm2os3=(rm2-suspend-fix) +installdepends_rmpp=(rmpp-make-root-rw) +installdepends_rmppos3=(rmpp-make-root-rw) image=base:v2.1 source=("https://example.org/toltec/${pkgnames[0]}/release-${pkgver%-*}.zip") @@ -80,6 +82,7 @@ def test_installdepends(self) -> None: Dependency(DependencyKind.HOST, "open-remarkable-shutdown") ] rm2_depends = [Dependency(DependencyKind.HOST, "rm2-suspend-fix")] + rmpp_depends = [Dependency(DependencyKind.HOST, "rmpp-make-root-rw")] recipes = parse_recipe(rec_path) @@ -95,6 +98,8 @@ def test_installdepends(self) -> None: "rm2", "rm2os2", "rm2os3", + "rmpp", + "rmppos3", ], ) recipe = recipes["rmall"] @@ -177,3 +182,21 @@ def test_installdepends(self) -> None: package.installdepends, set(basic_depends + rm2_depends), ) + + recipe = recipes["rmpp"] + self.assertIs(type(recipe), Recipe) + package = recipe.packages["toltec-base"] + self.assertEqual(list(recipe.packages.keys()), ["toltec-base"]) + self.assertEqual( + package.installdepends, + set(basic_depends + rmpp_depends), + ) + + recipe = recipes["rmppos3"] + self.assertIs(type(recipe), Recipe) + package = recipe.packages["toltec-base"] + self.assertEqual(list(recipe.packages.keys()), ["toltec-base"]) + self.assertEqual( + package.installdepends, + set(basic_depends + rmpp_depends), + ) diff --git a/toltec/builder.py b/toltec/builder.py index bfd53ea..e8607ba 100644 --- a/toltec/builder.py +++ b/toltec/builder.py @@ -316,13 +316,15 @@ def _build(self, recipe: Recipe, src_dir: str) -> None: ) if host_deps: - opkg_conf_path = "$SYSROOT/etc/opkg/opkg.conf" + opkg_conf_path = "$SYSROOT_AARCH64/etc/opkg/opkg.conf" if recipe.arch.startswith('rmpp') else "$SYSROOT/etc/opkg/opkg.conf" + opkg_exec = "opkg-aarch64" if recipe.arch.startswith('rmpp') else "opkg" + pre_script.extend( ( 'echo -n "dest root /', "arch all 100", - "arch armv7-3.2 160", - "src/gz entware https://bin.entware.net/armv7sf-k3.2", + f"arch {'aarch64-3.10' if recipe.arch.startswith('rmpp') else 'armv7-3.2'} 160", + f"src/gz entware https://bin.entware.net/{'aarch64-k3.10' if recipe.arch.startswith('rmpp') else 'armv7sf-k3.2'}", "arch rmall 200", "src/gz toltec-rmall file:///repo/rmall", f'" > "{opkg_conf_path}"', @@ -340,12 +342,19 @@ def _build(self, recipe: Recipe, src_dir: str) -> None: pre_script.extend( ( - "opkg update --verbosity=0", - "opkg install --verbosity=0 --no-install-recommends" + f"{opkg_exec} update --verbosity=0", + f"{opkg_exec} install --verbosity=0 --no-install-recommends" " -- " + " ".join(host_deps), ) ) + if recipe.arch.startswith('rmpp'): + pre_script.extend( + ( + "source /opt/x-tools/switch-aarch64.sh" + ) + ) + logs = bash.run_script_in_container( self.docker, image=self.IMAGE_PREFIX + recipe.image,