p7zip-project / p7zip

A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/sevenzip/ AND https://sourceforge.net/projects/p7zip/).
806 stars 111 forks source link

Codec plugins location #141

Open tansy opened 3 years ago

tansy commented 3 years ago

If I can suggest to move all codec plugins to separate codecs (or plugins for that matter) directory. Sources don't have to and should not to be in and among 7-zip main sources.

Moving codecs (I mean lizard, zstd, brotli and stuff) to separate libraries was right move, bull's eye I would say but the sources are unnecessarily "embedded" and "integrated" into main sources, which in my opinion make them harder to "follow" and maintain. After all, everything that connects them to main is plugin API, and that's all. For the same reason they don't have to be separated int C, CPP and stuff like that - they rather stick to their own directories which is clear and logical.

tansy commented 3 years ago

That's not exactly what I meant.

That's how it looks now:

├─ p7zip
│  ├─ .github
│  ├─ Asm
│  ├─ C
│  │  ├─ brotli
│  │  │  ├─ common
│  │  │  ├─ dec
│  │  │  └─ enc
│  │  ├─ fast-lzma2
│  │  ├─ hashes
│  │  ├─ lizard
│  │  ├─ lz4
│  │  ├─ lz5
│  │  ├─ zstd
│  │  └─ zstdmt
│  ├─ CPP
│  ├─ DOC
│  ├─ GUI
│  ├─ Utils
│  ├─ bin
│  ├─ check
│  ├─ contrib
│  ├─ man1
│  └─ rpm

And that's what I propose:

├─ p7zip
│  ├─ .github
│  ├─ Asm
│  ├─ C
│  ├─ CPP
│  ├─ Codecs
│  │  ├─ brotli
│  │  │  ├─ common
│  │  │  ├─ dec
│  │  │  └─ enc
│  │  ├─ fast-lzma2
│  │  ├─ hashes
│  │  ├─ lizard
│  │  ├─ lz4
│  │  ├─ lz5
│  │  ├─ zstd
│  │  └─ zstdmt
│  ├─ DOC
│  ├─ GUI
│  ├─ Utils
│  ├─ bin
│  ├─ check
│  ├─ contrib
│  ├─ man1
│  └─ rpm

As you can see, codecs are in there own, separate directory and not in C or CPP as language of codec has nothing to do with it. This way they are easily manageable which is the most important reason, "immune" to changes in main source, they have their own makefiles and stuff like that.

jinfeihan57 commented 3 years ago

I guess one possible method is to make use of Git submodule.

For example, codecs directory can be a submodule pointing to another repository, which is solely for hosting the source code of added codecs.

This way, when a codec is updated (e.g. Zstd 1.4.9 -> 1.5.0), we will not see a large diff in the main repository (and instead only a very small diff indicating that the submodule commit used has been updated).

This repository's main branch uses the same codec sources as in mcmilk's repository, but the 7zip_21.02 branch seems to be using the "raw" sources, which include unnecessary files, e.g. tests.

P.S. It also seems that due to "raw" codec sources being used, the 7zip_21.02 branch will need cmake for compiling the codec.

My plan is to use submodule eventually. But it needs to be done step by step. At this stage, the source code of the compression algorithm, cmake and makefile are used to build static and dynamic libraries.