Modify & Rebuild mongoose library

If you are asking a question, please follow this template:

  1. My goal is:
    [download/modify/rebuild library https://github.com/cesanta/mongoose]
  2. My actions are: [Using “mos build --platform esp8266” to build project]
  3. The result I see is:
    [
    in mos_final.yml
    origin: https://github.com/mongoose-os-libs/mongoose
    location: https://github.com/mongoose-os-libs/mongoose
    name: mongoose
    path: /data/fwbuild-volumes/2.19.1/apps/Http_esp8266/esp8266/build_contexts/build_ctx_338561145/deps/mongoose
    version: “6.16”
    ]
  4. My expectation & question is:
    [
    Is there a doc/procedure explain how to build a library after modified ?
    e.g. I want to have the version: “7.3” of https://github.com/mongoose-os-libs/mongoose
    and add some debug print
    ]

https://github.com/mongoose-os-libs/mongoose is one of the libraries that is close source. You can’t modify it.
mos will stay on 6.x for the foreseeable future.

How about other open-source library ?

Fork the repo, clone, modify, build, etc…

If you want to modify one of the mongoose-os-libs you should build locally.
If you want to build remotely you will most likely end up getting the unmodified library, what I’ve been doing so far (just what I fancy and works for me) is to place a copy on the deps directory and in mos.yml use - name: libname (instead of - origin: https://github.com/mongoose-os-libs/libname). Before each build, erase the deps and build directories and copy your modified libname contents to deps/libname, which is trivial from the command line.
This works also for developing your own lib. Most developers seem to use Docker and build locally.

Yes, that’s the way I do it all the time. And I have lots of common code and libraries which are placed in directories out of the application’s source tree.

sources:
  - src
  - ../common/event-handler-wrapper
  - ../common/rpc-wrapper
  - ../common/ws-client

libs:
  - origin: ../libs/hdc1080-i2c
  - origin: ../libs/hdc20x0-i2c
  - origin: ../libs/json-queue

This layout works for remote builds too, provided the size of the upload is les than ~5MB, I think. There is no need to play with the deps directory and local builds anymore.

LE. Forgot to mention the posibilty to create a private build server. It works for me on Debian buster.

1 Like