Permalink
Browse files

Add automated debian package builder.

  • Loading branch information...
1 parent d4cfaf2 commit a5db4cfbd1aa6faeb930fdcb8c00a4d750de845a @ajclinto committed May 12, 2013
Showing with 69 additions and 8 deletions.
  1. +1 −1 .gitignore
  2. +16 −7 Window.C
  3. +42 −0 debian/Makefile
  4. +10 −0 debian/control.src
View
@@ -1,4 +1,4 @@
*.o
-Makefile
+/Makefile
memview
moc_Window.cpp
View
@@ -360,9 +360,17 @@ void MemViewWidget::batchSize(int value)
// Load a file into a buffer. The buffer is owned by the caller, and
// should be freed with delete[].
static char *
-loadTextFile(const char *filename)
+loadTextFile(const char *filename, const std::vector<std::string> &paths)
{
- std::ifstream is(filename);
+ std::ifstream is;
+ for (auto it = paths.begin(); it != paths.end(); ++it)
+ {
+ std::string path = *it + filename;
+
+ is.open(path.c_str());
+ if (is.good())
+ break;
+ }
if (!is.good())
return 0;
@@ -450,17 +458,18 @@ MemViewWidget::initializeGL()
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, type);
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, type);
- std::string shader_path;
+ std::vector<std::string> paths;
+ paths.push_back("");
+ paths.push_back(myPath);
+ paths.push_back("/usr/share/memview/");
QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
- shader_path = myPath + "shader.vert";
- const char *vsrc = loadTextFile(shader_path.c_str());
+ const char *vsrc = loadTextFile("shader.vert", paths);
vshader->compileSourceCode(vsrc);
delete [] vsrc;
QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
- shader_path = myPath + "shader.frag";
- const char *fsrc = loadTextFile(shader_path.c_str());
+ const char *fsrc = loadTextFile("shader.frag", paths);
fshader->compileSourceCode(fsrc);
delete [] fsrc;
View
@@ -0,0 +1,42 @@
+VERSION = 1.0-1
+
+BIN_INSTALL_DIR = debian/usr/bin
+SHARE_INSTALL_DIR = debian/usr/share/memview
+VALGRIND_INSTALL_DIR = debian/usr/lib/valgrind
+
+VALGRIND_SRC = ~/projects/repo/valgrind
+
+# depends: dpkg-shlibdeps --ignore-missing-info -O debian/usr/bin/memview
+
+PACKAGE_NAME = memview_$(VERSION)_amd64.deb
+
+MEMVIEW_BIN = ../memview
+MEMVIEW_FRAG = ../shader.frag
+MEMVIEW_VERT = ../shader.vert
+MEMVIEW_TOOL = $(VALGRIND_SRC)/memview/memview-amd64-linux
+MEMVIEW_PRELOAD = $(VALGRIND_SRC)/memview/vgpreload_memview-amd64-linux.so
+
+top: $(PACKAGE_NAME)
+
+control: control.src
+ sed -e "s/<<architecture>>/`dpkg --print-architecture`/g" \
+ -e "s/<<version>>/$(VERSION)/g" control.src > control
+
+$(PACKAGE_NAME): control $(MEMVIEW_BIN) $(MEMVIEW_FRAG) $(MEMVIEW_VERT) $(MEMVIEW_TOOL) $(MEMVIEW_PRELOAD)
+ mkdir -p $(BIN_INSTALL_DIR)
+ cp $(MEMVIEW_BIN) $(BIN_INSTALL_DIR)
+ mkdir -p $(SHARE_INSTALL_DIR)
+ cp $(MEMVIEW_FRAG) $(SHARE_INSTALL_DIR)
+ cp $(MEMVIEW_VERT) $(SHARE_INSTALL_DIR)
+ mkdir -p $(VALGRIND_INSTALL_DIR)
+ cp $(MEMVIEW_TOOL) $(VALGRIND_INSTALL_DIR)
+ cp $(MEMVIEW_PRELOAD) $(VALGRIND_INSTALL_DIR)
+ mkdir -p debian/DEBIAN
+ cp control debian/DEBIAN
+ dpkg-deb --build debian
+ mv debian.deb $(PACKAGE_NAME)
+
+clean:
+ rm -rf debian
+ rm -f control
+ rm -f $(PACKAGE_NAME)
View
@@ -0,0 +1,10 @@
+Package: memview
+Version: <<version>>
+Section: devel
+Priority: optional
+Architecture: <<architecture>>
+Depends: valgrind (>= 3.8), libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libqt4-opengl (>= 4:4.6.1), libqtcore4 (>= 4:4.8.0), libqtgui4 (>= 4:4.5.3), libstdc++6 (>= 4.6)
+Maintainer: Andrew Clinton <ajclinto@gmail.com>
+Homepage: https://github.com/ajclinto/memview
+Description: A real-time memory trace visualizer using valgrind
+ Memview is a real-time visualization program that will show the memory state of another running program as a graphical image. Memory addresses correspond to pixels in the image, and as memory is accessed the display will animate to show what parts of the address space are currently being referenced by the program.

0 comments on commit a5db4cf

Please sign in to comment.