From 2046296222caa085d5eed72f534fae877a5b7dd1 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 6 Jun 2012 03:32:56 +0200 Subject: dev-util/mtools: add live ebuild for mifare gui tools --- dev-util/mtools/Manifest | 5 ++ .../mtools/files/mtools-fix-glade-file-path.patch | 11 +++ .../files/mtools-new-libfreefare-version.patch | 21 ++++++ .../mtools/files/mtools-new-libnfc-version.patch | 62 ++++++++++++++++ .../files/mtools-remove-not-working-stuff.patch | 83 ++++++++++++++++++++++ dev-util/mtools/mtools-9999.ebuild | 48 +++++++++++++ 6 files changed, 230 insertions(+) create mode 100644 dev-util/mtools/Manifest create mode 100644 dev-util/mtools/files/mtools-fix-glade-file-path.patch create mode 100644 dev-util/mtools/files/mtools-new-libfreefare-version.patch create mode 100644 dev-util/mtools/files/mtools-new-libnfc-version.patch create mode 100644 dev-util/mtools/files/mtools-remove-not-working-stuff.patch create mode 100644 dev-util/mtools/mtools-9999.ebuild (limited to 'dev-util') diff --git a/dev-util/mtools/Manifest b/dev-util/mtools/Manifest new file mode 100644 index 0000000..3777b29 --- /dev/null +++ b/dev-util/mtools/Manifest @@ -0,0 +1,5 @@ +AUX mtools-fix-glade-file-path.patch 309 RMD160 66533722ec4c20d0928467460db02487e375ec53 SHA1 44bba24567c243950ade9667b4efe40096449048 SHA256 43d65a109989a53c4d869b5f5378a9e1997a885f6ac02f5e5e325d4f3f9d82ee +AUX mtools-new-libfreefare-version.patch 441 RMD160 003341192b7a6769bac08d4231c116ca159aeecf SHA1 ab5e84c1b99992ebe5a7f84c1636193041ed8998 SHA256 40ffc95a08727a8623f76a0a5898614d83c11746e6796e09bfb44999c7e87649 +AUX mtools-new-libnfc-version.patch 1365 RMD160 766caf4e35e582475a724bc8e199e9fb000d288d SHA1 77a2e8dafeebb45561eae86deb843934081dd604 SHA256 d3c7fb7704c776316ca04387718ae13d3ee56debda55188bbf700439a7f15c57 +AUX mtools-remove-not-working-stuff.patch 2438 RMD160 ca6fd24e67469bee59540336c1d78868c407f0a4 SHA1 2349192bd31f3eb773440d0102bcaf91f9543df0 SHA256 2b97665a4b711768e3dfce4c7b475d516a99fdf0b89e7247668f56f42e69f55a +EBUILD mtools-9999.ebuild 1306 RMD160 3a064586726a2c823eaf87ad9afcda693f4d7473 SHA1 3e5685c659373f35e4fa7e7ff913a4c2195095d4 SHA256 6eb90c225aae16021995e56746f65bae5a24baff29a3b0a8dbb4637b2fdf0a01 diff --git a/dev-util/mtools/files/mtools-fix-glade-file-path.patch b/dev-util/mtools/files/mtools-fix-glade-file-path.patch new file mode 100644 index 0000000..fe8a00b --- /dev/null +++ b/dev-util/mtools/files/mtools-fix-glade-file-path.patch @@ -0,0 +1,11 @@ +--- src/gtk/Mtools.cpp (revision 24) ++++ src/gtk/Mtools.cpp (working copy) +@@ -10,7 +10,7 @@ + #include "gtk/Mtools.h" + #include "gtk/Application.h" + +-const std::string Mtools::MTOOLS_UI = "mtools.glade"; ++const std::string Mtools::MTOOLS_UI = "/usr/share/mifare-tools/mtools.glade"; + + Mtools::Mtools() { + } diff --git a/dev-util/mtools/files/mtools-new-libfreefare-version.patch b/dev-util/mtools/files/mtools-new-libfreefare-version.patch new file mode 100644 index 0000000..f7f6c4e --- /dev/null +++ b/dev-util/mtools/files/mtools-new-libfreefare-version.patch @@ -0,0 +1,21 @@ +--- src/Nfc.cpp (revision 24) ++++ src/Nfc.cpp (working copy) +@@ -154,15 +156,9 @@ + + std::string Nfc::Tag::getUid() { + std::string uid = ""; +- if(isClassic()) { +- char* pUid = mifare_classic_get_uid (tag); +- uid = pUid; +- free(pUid); +- } else if(isUltralight()) { +- char* pUid = mifare_ultralight_get_uid (tag); +- uid = pUid; +- free(pUid); +- } ++ char* pUid = freefare_get_tag_uid (tag); ++ uid = pUid; ++ free(pUid); + + return uid; + } diff --git a/dev-util/mtools/files/mtools-new-libnfc-version.patch b/dev-util/mtools/files/mtools-new-libnfc-version.patch new file mode 100644 index 0000000..3a44984 --- /dev/null +++ b/dev-util/mtools/files/mtools-new-libnfc-version.patch @@ -0,0 +1,62 @@ +--- configure.ac (revision 24) ++++ configure.ac (working copy) +@@ -30,7 +30,7 @@ + fi + + # Checks for libraries. +-AC_CHECK_LIB(nfc, nfc_connect,,AC_MSG_ERROR(Install libnfc)) ++AC_CHECK_LIB(nfc, nfc_version,,AC_MSG_ERROR(Install libnfc)) + AC_CHECK_LIB(freefare, mifare_classic_connect,,AC_MSG_ERROR(Install libfreefare)) + AC_CHECK_LIB(gthread-2.0, g_thread_init) + +--- src/Nfc.cpp (revision 24) ++++ src/Nfc.cpp (working copy) +@@ -31,22 +31,24 @@ + }; + + Nfc::Nfc() : dev(NULL), tags(NULL) { ++ nfc_init(NULL); + selectedTag = -1; + connect(); + } + + Nfc::~Nfc() { + disconnect(); ++ nfc_exit(NULL); + } + + void Nfc::connect() { + if(dev) return; +- dev = nfc_connect(NULL); ++ dev = nfc_open(NULL, NULL); + } + + void Nfc::disconnect() { + if (!dev) return; +- nfc_disconnect(dev); ++ nfc_close(dev); + dev = NULL; + } + +--- src/Nfc.h (revision 24) ++++ src/Nfc.h (working copy) +@@ -83,7 +80,7 @@ + + Nfc::Tag* findTag(); + protected: +- nfc_device_t* dev; ++ nfc_device* dev; + + int selectedTag; + MifareTag* tags; +--- src/Utils.h (revision 24) ++++ src/Utils.h (working copy) +@@ -30,7 +30,7 @@ + return ss.str().c_str(); + } + +- static std::string pByteToStrHex(byte_t* bytes, unsigned int len) { ++ static std::string pByteToStrHex(uint8_t* bytes, unsigned int len) { + std::stringstream ss; + for(unsigned int i = 0; i < len; i++) + ss << std::hex << (unsigned int)bytes[i]; diff --git a/dev-util/mtools/files/mtools-remove-not-working-stuff.patch b/dev-util/mtools/files/mtools-remove-not-working-stuff.patch new file mode 100644 index 0000000..bc69132 --- /dev/null +++ b/dev-util/mtools/files/mtools-remove-not-working-stuff.patch @@ -0,0 +1,83 @@ +--- src/Makefile.am (revision 24) ++++ src/Makefile.am (working copy) +@@ -19,10 +19,7 @@ + Nfc.cpp Nfc.h Utils.h \ + gtk/Consts.cpp gtk/Consts.h \ + gtk/GtkUtil.h gtk/GtkUtil.cpp \ +- gtk/dialogs/ErrorDialog.cpp gtk/dialogs/ErrorDialog.h \ +- gtk/dialogs/KeysChooserDialog.cpp gtk/dialogs/KeysChooserDialog.h \ +- gtk/dialogs/KeysStoreDialog.cpp gtk/dialogs/KeysStoreDialog.h \ +- gtk/dialogs/InputDialog.cpp gtk/dialogs/InputDialog.h ++ gtk/dialogs/ErrorDialog.cpp gtk/dialogs/ErrorDialog.h + + + mtools_LDFLAGS = -lboost_regex-mt -lboost_thread-mt +--- src/Nfc.h (revision 24) ++++ src/Nfc.h (working copy) +@@ -16,9 +16,6 @@ + + #include + +-#include +-#include +- + /** + * This class is c++ wrapper for libfreefare library. + */ +--- src/gtk/Callbacks.cpp (revision 24) ++++ src/gtk/Callbacks.cpp (working copy) +@@ -66,10 +66,6 @@ + app->getBuilder()->get_widget("miSearch", pMiSearch); + pMiSearch->signal_activate().connect(sigc::mem_fun(*this, &Callbacks::onBtnSearchClicked)); + +- Gtk::ImageMenuItem* pMiOpenKeys; +- app->getBuilder()->get_widget("miOpenKeys", pMiOpenKeys); +- pMiOpenKeys->signal_activate().connect(sigc::mem_fun(*this, &Callbacks::onMiOpenKeys)); +- + Gtk::ImageMenuItem* pMiAbout; + app->getBuilder()->get_widget("miAbout", pMiAbout); + pMiAbout->signal_activate().connect(sigc::mem_fun(*this, &Callbacks::about)); +@@ -78,8 +74,6 @@ + app->getBuilder()->get_widget("dlgAbout", pDlgAbout); + pDlgAbout->signal_response().connect(sigc::mem_fun(*this, &Callbacks::onDlgAboutResponse)); + +- dlgKeysStore.signal_changed.connect(sigc::mem_fun(*this, &Callbacks::onKeysStoreChange)); +- + nfc = new Nfc(); + } + +@@ -260,10 +254,6 @@ + Gtk::Main::quit(); + } + +-void Callbacks::onMiOpenKeys() { +- dlgKeysStore.run(); +-} +- + void Callbacks::authenticate(int sector) { + unsigned char key[6] = {0}; + +--- src/gtk/Callbacks.h (revision 24) ++++ src/gtk/Callbacks.h (working copy) +@@ -13,13 +13,10 @@ + #include "gtk/DataAccessConditions.h" + #include "gtk/TrailerAccessConditions.h" + +-#include "gtk/dialogs/KeysStoreDialog.h" + #include + #include "gtk/ComboBoxText.h" + + +-#include +- + class Callbacks { + public: + Callbacks(); +@@ -59,7 +56,6 @@ + DataAccessConditions dataAC; + TrailerAccessConditions trailerAC; + +- KeysStoreDialog dlgKeysStore; + void onKeysStoreChange(std::vector v); + + void onBtnSearchClicked(); diff --git a/dev-util/mtools/mtools-9999.ebuild b/dev-util/mtools/mtools-9999.ebuild new file mode 100644 index 0000000..a2347f6 --- /dev/null +++ b/dev-util/mtools/mtools-9999.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="2" + +inherit eutils subversion autotools + +DESCRIPTION="Mifare GUI Tools" +HOMEPAGE="http://code.google.com/p/mtools/" +ESVN_REPO_URI="http://mtools.googlecode.com/svn/trunk/mtools/" +ESVN_PROJECT="mtools" + +LICENSE="LGPL-3" +SLOT="0" +KEYWORDS="~x86 ~amd64" + +CDEPEND=">=dev-libs/libnfc-1.5.1" +RDEPEND="${CDEPEND}" + +src_prepare() { + epatch "${FILESDIR}/mtools-new-libnfc-version.patch" + epatch "${FILESDIR}/mtools-new-libfreefare-version.patch" + epatch "${FILESDIR}/mtools-fix-glade-file-path.patch" + + epatch "${FILESDIR}/mtools-remove-not-working-stuff.patch" + rm src/gtk/dialogs/KeysChooserDialog.cpp \ + src/gtk/dialogs/InputDialog.cpp \ + src/gtk/dialogs/KeysChooserDialog.h \ + src/gtk/dialogs/InputDialog.h \ + src/gtk/dialogs/KeysStoreDialog.cpp \ + src/gtk/dialogs/KeysStoreDialog.h + + eautoreconf || die "autoreconf failed" +} + +src_install() { + emake DESTDIR="${D}" install || die "Install failed" + + # collision with sys-fs/mtools + mv "${D}/usr/bin/mtools" "${D}/usr/bin/mifare-tools" + + # install glade file + insinto "/usr/share/mifare-tools/" + doins mtools.glade + + dodoc README ChangeLog AUTHORS NEWS || die +} -- cgit v1.2.3