firmware-mod-kit-9999.ebuild 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright 2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit git-r3 toolchain-funcs
  5. DESCRIPTION="Utilities to to extract and rebuild firmware images for various embedded devices"
  6. HOMEPAGE="https://code.google.com/p/firmware-mod-kit/wiki/Documentation"
  7. EGIT_REPO_URI="https://github.com/rampageX/firmware-mod-kit"
  8. LICENSE="MIT"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~x86"
  11. IUSE="doc"
  12. DEPEND="
  13. app-arch/xz
  14. sys-libs/zlib
  15. "
  16. RDEPEND="${DEPEND}"
  17. #BDEPEND="app-text/dos2unix"
  18. #PATCHES="${FILESDIR}"/gcc10.patch
  19. #S=${WORKDIR}/${P}/src
  20. src_prepare() {
  21. sed -e 's|struct global|extern struct global|' -i "${S}"/src/webcomp-tools/common.h || die
  22. sed -e '12 i\struct global globals = {};' -i "${S}"/src/webcomp-tools/common.c || die
  23. # dos2unix ${S}/src/others/squashfs-3.4-cisco/squashfs-tools/mksquashfs.c
  24. default
  25. }
  26. src_configure(){
  27. cd src && econf
  28. }
  29. src_compile() {
  30. cd src && emake CC="$(tc-getCC)" asustrx addpattern untrx motorola-bin splitter3 && \
  31. emake CC="$(tc-getCC)" -C ./wrt_vx_imgtool && \
  32. emake CC="$(tc-getCC)" -C ./firmware-tools && \
  33. emake CC="$(tc-getCC)" -C ./tpl-tool/src && \
  34. emake CC="$(tc-getCC)" -C ./crcalc && \
  35. emake CC="$(tc-getCC)" -C ./webcomp-tools && \
  36. emake CC="$(tc-getCC)" -C ./bff
  37. }
  38. src_install() {
  39. cd src
  40. find ${S} -name '*.o' -delete
  41. dobin asustrx addpattern untrx motorola-bin splitter3 \
  42. wrt_vx_imgtool/wrt_vx_imgtool \
  43. firmware-tools/{buffalo-enc,unwdk.py,unzlib.py} \
  44. tpl-tool/src/tpl-tool \
  45. crcalc/{crcalc,crc32} \
  46. webcomp-tools/webdecomp \
  47. bff/{bff_huffman_decompress,bffxtractor.py}
  48. use doc && default
  49. }