playmean / fap-list

Collection of Flipper Zero applications with .fap files
https://flipc.org
460 stars 23 forks source link

Flipper Authenticator build fails #9

Closed akopachov closed 1 year ago

akopachov commented 1 year ago

Flipper Authenticator build fails.

Starting from v1.8.0 I added support of Xtreme firmware and usage of its specific features. To make codebase backward-compatible with Official firmware I put all the firmware-specific change into #if...#endif blocks controlled by #define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME line in totp/features_config.h file.

Consider updating build pipeline you have for Flipper Authenticator app by updating #define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME to #define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_STABLE or #define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_OFFICIAL_DEV before running actual build process.

playmean commented 1 year ago

Service is not controlling any of app's configuration. Only fbt tool and SDK is used from specified firmware (repository).

playmean commented 1 year ago

Maybe I can patch SDK headers or set environment variable. What variant is possible to catch in app's code without external scripting/patching?

akopachov commented 1 year ago

I guess If you would be able to somehow globally define #define TOTP_TARGET_FIRMWARE 1 then it should help.

akopachov commented 1 year ago

I worked on the improvements for build script for Flipper Authenticator and found a simple way to patch standard scons files to bypass any cdefs.

Consider looking at my fbt.ps1 file lines 47-50 which I'm using as a wrapper around standard FBT files. You may use similar approach to patch \site_scons\cc.scons file and pass whatever is necessary to compiler (incl. custom flags and defs).

Given that change, I also updated features_config.h file to simplify customizing builds. For now there is no need to patch this file, instead things could be configured with appropriate compiler commands.

playmean commented 1 year ago

Cloning all of your submodules takes a lot of time 🤔

playmean commented 1 year ago

You can now try checking for TARGET_FIRMWARE_* [OFFICIAL, UNLEASHED, ROGUEMASTER] define (ex. TARGET_FIRMWARE_OFFICIAL)

akopachov commented 1 year ago

Thanks for introducing these changes.

I tried to incorporate them https://github.com/akopachov/flipper-zero_authenticator/pull/139/files but it looks like either I'm doing it wrong, or the changes you introduced are not yet part of https://flipc.org/, because when I'm trying to build Authenticator app using it it still fails with the same errors as before.

Would appreciate any assistance with this.

Oh, also on submodules stuff - you may not clone them if you are not using them as a part of the build. The reason why I have them is to make Authenticator app simpler to build and easier to maintain firmware dependencies. So each time I do a release I always know what what the firmware version Auth app is built of. And as a side effect - it also make it super easy thin to build for newbies. They just git clone and then run ./build.ps1 and that's it :)

playmean commented 1 year ago

I've fixed defining of constant and now it works :)

I think I can remove firmware-related submodules before building apps. I'll do it a bit later.

akopachov commented 1 year ago

Perfect! Thanks for fixing it!

Leaving this issue open given that you have some plans to exclude firmware-related submodules from git pull. Consider closing this issue when you feel everything you wanted to make done - is done.

playmean commented 1 year ago

Will continue doing optimisations in #10. Closing this issue. Thank you!