|
| 1 | +# Copyright 1999-2023 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +inherit udev toolchain-funcs |
| 7 | + |
| 8 | +if [ "${PV}" = "9999" ]; then |
| 9 | + inherit git-r3 |
| 10 | + EGIT_REPO_URI="https://github.com/RfidResearchGroup/proxmark3.git" |
| 11 | + RESTRICT="strip" |
| 12 | +else |
| 13 | + #snapshot |
| 14 | + #HASH_COMMIT="1ac5211601b50b82b41737dce0c3a72d9e0374ac" |
| 15 | + #SRC_URI="https://github.com/RfidResearchGroup/${PN}/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz" |
| 16 | + #S=${WORKDIR}/${PN}-${HASH_COMMIT} |
| 17 | + |
| 18 | + #or release |
| 19 | + KEYWORDS="amd64" |
| 20 | + SRC_URI="https://github.com/RfidResearchGroup/proxmark3/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
| 21 | +fi |
| 22 | +DESCRIPTION="A general purpose RFID tool for Proxmark3 hardware" |
| 23 | +HOMEPAGE="https://github.com/RfidResearchGroup/proxmark3" |
| 24 | + |
| 25 | +LICENSE="GPL-3+" |
| 26 | +SLOT="0" |
| 27 | +STANDALONE="standalone-lf-em4100emul standalone-lf-em4100rswb standalone-lf-em4100rwc standalone-lf-hidbrute standalone-lf-hidfcbrute standalone-lf-icehid standalone-lf-nexid standalone-lf-proxbrute standalone-lf-samyrun standalone-lf-tharexde standalone-hf-14asniff standalone-hf-15sniff standalone-hf-aveful standalone-hf-bog standalone-hf-cardhopper standalone-hf-colin standalone-hf-craftbyte standalone-hf-iceclass standalone-hf-legic standalone-hf-mattyrun standalone-hf-mfcsim standalone-hf-msdsal standalone-hf-reblay standalone-hf-tcprst standalone-hf-tmudford standalone-hf-unisniff standalone-hf-young standalone-dankarmulti" |
| 28 | +IUSE="+bluez deprecated +firmware +pm3rdv4 +qt ${STANDALONE}" |
| 29 | +REQUIRED_USE="?? ( ${STANDALONE/+/} ) |
| 30 | + standalone-lf-hidfcbrute? ( pm3rdv4 ) |
| 31 | + standalone-lf-icehid? ( pm3rdv4 ) |
| 32 | + standalone-lf-nexid? ( pm3rdv4 ) |
| 33 | + standalone-lf-tharexde? ( pm3rdv4 ) |
| 34 | + standalone-hf-14asniff? ( pm3rdv4 ) |
| 35 | + standalone-hf-15sniff? ( pm3rdv4 ) |
| 36 | + standalone-hf-bog? ( pm3rdv4 ) |
| 37 | + standalone-hf-cardhopper? ( pm3rdv4 ) |
| 38 | + standalone-hf-colin? ( pm3rdv4 ) |
| 39 | + standalone-hf-iceclass? ( pm3rdv4 ) |
| 40 | + standalone-hf-mfcsim? ( pm3rdv4 ) |
| 41 | + standalone-hf-reblay? ( pm3rdv4 ) |
| 42 | + " |
| 43 | + |
| 44 | +DEPEND=" |
| 45 | + app-arch/bzip2 |
| 46 | + app-arch/lz4:= |
| 47 | + dev-libs/jansson:= |
| 48 | + dev-libs/openssl:= |
| 49 | + sys-libs/readline:= |
| 50 | + bluez? ( net-wireless/bluez:= ) |
| 51 | + qt? ( dev-qt/qtcore:5 |
| 52 | + dev-qt/qtwidgets:5 |
| 53 | + dev-qt/qtgui:5 ) |
| 54 | +" |
| 55 | +#this is basically just used for termcap |
| 56 | +RDEPEND="${DEPEND} |
| 57 | + sys-libs/ncurses:*[tinfo] |
| 58 | + " |
| 59 | +BDEPEND="firmware? ( sys-devel/gcc-arm-none-eabi:0 )" |
| 60 | + |
| 61 | +QA_FLAGS_IGNORED="usr/share/proxmark3/firmware/bootrom.elf |
| 62 | + usr/share/proxmark3/firmware/fullimage.elf" |
| 63 | + |
| 64 | +src_prepare(){ |
| 65 | + default |
| 66 | + #first we set platform |
| 67 | + if use pm3rdv4; then |
| 68 | + echo 'PLATFORM=PM3RDV4' > Makefile.platform |
| 69 | + echo 'PLATFORM_EXTRAS=BTADDON' >> Makefile.platform |
| 70 | + else |
| 71 | + echo 'PLATFORM=PM3GENERIC' > Makefile.platform |
| 72 | + fi |
| 73 | + #then we set a standalone mode |
| 74 | + if use standalone-lf-em4100emul; then |
| 75 | + echo 'STANDALONE=LF_EM4100EMUL' >> Makefile.platform |
| 76 | + elif use standalone-lf-em4100rswb; then |
| 77 | + echo 'STANDALONE=LF_EM4100RSWB' >> Makefile.platform |
| 78 | + elif use standalone-lf-em4100rwc; then |
| 79 | + echo 'STANDALONE=LF_EM4100RWC' >> Makefile.platform |
| 80 | + elif use standalone-lf-hidbrute; then |
| 81 | + echo 'STANDALONE=LF_HIDBRUTE' >> Makefile.platform |
| 82 | + elif use standalone-lf-hidfcbrute; then |
| 83 | + echo 'STANDALONE=LF_HIDFCBRUTE' >> Makefile.platform |
| 84 | + elif use standalone-lf-icehid; then |
| 85 | + echo 'STANDALONE=LF_ICEHID' >> Makefile.platform |
| 86 | + elif use standalone-lf-nexid; then |
| 87 | + echo 'STANDALONE=LF_NEXID' >> Makefile.platform |
| 88 | + elif use standalone-lf-proxbrute; then |
| 89 | + echo 'STANDALONE=LF_PROXBRUTE' >> Makefile.platform |
| 90 | + elif use standalone-lf-samyrun; then |
| 91 | + echo 'STANDALONE=LF_SAMYRUN' >> Makefile.platform |
| 92 | + elif use standalone-lf-tharexde; then |
| 93 | + echo 'STANDALONE=LF_THAREXDE' >> Makefile.platform |
| 94 | + elif use standalone-hf-14asniff; then |
| 95 | + echo 'STANDALONE=HF_14ASNIFF' >> Makefile.platform |
| 96 | + elif use standalone-hf-15sniff; then |
| 97 | + echo 'STANDALONE=HF_15SNIFF' >> Makefile.platform |
| 98 | + elif use standalone-hf-aveful; then |
| 99 | + echo 'STANDALONE=HF_AVEFUL' >> Makefile.platform |
| 100 | + elif use standalone-hf-bog; then |
| 101 | + echo 'STANDALONE=HF_BOG' >> Makefile.platform |
| 102 | + elif use standalone-hf-cardhopper; then |
| 103 | + echo 'STANDALONE=HF_CARDHOPPER' >> Makefile.platform |
| 104 | + elif use standalone-hf-colin; then |
| 105 | + echo 'STANDALONE=HF_COLIN' >> Makefile.platform |
| 106 | + elif use standalone-hf-craftbyte; then |
| 107 | + echo 'STANDALONE=HF_CRAFTBYTE' >> Makefile.platform |
| 108 | + elif use standalone-hf-iceclass; then |
| 109 | + echo 'STANDALONE=HF_ICECLASS' >> Makefile.platform |
| 110 | + elif use standalone-hf-legic; then |
| 111 | + echo 'STANDALONE=HF_LEGIC' >> Makefile.platform |
| 112 | + elif use standalone-hf-mattyrun; then |
| 113 | + echo 'STANDALONE=HF_MATTYRUN' >> Makefile.platform |
| 114 | + elif use standalone-hf-msdsal; then |
| 115 | + echo 'STANDALONE=HF_MSDSAL' >> Makefile.platform |
| 116 | + elif use standalone-hf-reblay; then |
| 117 | + echo 'STANDALONE=HF_REBLAY' >> Makefile.platform |
| 118 | + elif use standalone-hf-tcprst; then |
| 119 | + echo 'STANDALONE=HF_TCPRST' >> Makefile.platform |
| 120 | + elif use standalone-hf-tmudford; then |
| 121 | + echo 'STANDALONE=HF_TMUDFORD' >> Makefile.platform |
| 122 | + elif use standalone-hf-unisniff; then |
| 123 | + echo 'STANDALONE=HF_UNISNIFF' >> Makefile.platform |
| 124 | + elif use standalone-hf-young; then |
| 125 | + echo 'STANDALONE=HF_YOUNG' >> Makefile.platform |
| 126 | + elif use standalone-dankarmulti; then |
| 127 | + echo 'STANDALONE=DANKARMULTI' >> Makefile.platform |
| 128 | + else |
| 129 | + echo 'STANDALONE=' >> Makefile.platform |
| 130 | + fi |
| 131 | +} |
| 132 | + |
| 133 | +src_compile(){ |
| 134 | + export PREFIX=/usr |
| 135 | + #verbose |
| 136 | + export V=1 |
| 137 | + #common flags |
| 138 | + EMAKE_COMMON=CC="$(tc-getCC)" DEFCFLAGS="${CFLAGS}" MYCFLAGS="${CFLAGS}" MYCXXFLAGS="${CXXFLAGS}" MYLDFLAGS="${LDFLAGS}" |
| 139 | + use qt || export SKIPQT=1 |
| 140 | + use bluez || export SKIPBT=1 |
| 141 | + if use firmware; then |
| 142 | + emake ${EMAKE_COMMON} client |
| 143 | + emake ${EMAKE_COMMON} all |
| 144 | + elif use deprecated; then |
| 145 | + emake ${EMAKE_COMMON} client |
| 146 | + emake ${EMAKE_COMMON} mfkey nonce2key |
| 147 | + else |
| 148 | + emake ${EMAKE_COMMON} client |
| 149 | + fi |
| 150 | +} |
| 151 | + |
| 152 | +src_install(){ |
| 153 | + export PREFIX=/usr |
| 154 | + export DESTDIR="${ED}" |
| 155 | + export UDEV_PREFIX="$(get_udevdir)/rules.d" |
| 156 | + export INSTALLDOCSRELPATH="/share/doc/${PF}" |
| 157 | + if use firmware; then |
| 158 | + emake INSTALLDOCSRELPATH="/share/doc/${PF}" install |
| 159 | + elif use deprecated; then |
| 160 | + emake INSTALLDOCSRELPATH="/share/doc/${PF}" client/install mfkey/install nonce2key/install common/install |
| 161 | + else |
| 162 | + emake INSTALLDOCSRELPATH="/share/doc/${PF}" client/install common/install |
| 163 | + fi |
| 164 | +} |
| 165 | + |
| 166 | +src_test() { |
| 167 | + if use firmware; then |
| 168 | + ./pm3test.sh |
| 169 | + else |
| 170 | + ./pm3test.sh client |
| 171 | + fi |
| 172 | +} |
| 173 | + |
| 174 | +pkg_postinst() { |
| 175 | + udev_reload |
| 176 | + if use firmware; then |
| 177 | + if use pm3rdv4; then |
| 178 | + ewarn "Please note, all firmware and recovery files are intended for the Proxmark3 RDV4" |
| 179 | + ewarn "including support for the optional blueshark accessory." |
| 180 | + ewarn "If this is not what you intended please unset the pm3rdv4 use flag for generic firmware" |
| 181 | + else |
| 182 | + ewarn "Please note, all firmware and recovery files are built for a generic target." |
| 183 | + ewarn "If you have a Proxmark3 RDV4 you should set the pm3rdv4 use flag for an improved firmware" |
| 184 | + fi |
| 185 | + fi |
| 186 | +} |
| 187 | + |
| 188 | +pkg_postrm() { |
| 189 | + udev_reload |
| 190 | +} |
0 commit comments