psppacker dependancy

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
_df_
Posts: 9
Joined: Fri Jun 01, 2007 12:45 pm

psppacker dependancy

Post by _df_ »

psppacker is missing a bin2c dependancy.

I have my own bin2c and it took a while to figure out why psppacker wasnt compiling correctly. I modified my own bin2c programs output so psp-packer compiled.

just as an FYI heads up...

mm I knocked out a patch that adds a bin2c and an install clause into the setup. I did an svn add then svn diff...

Code: Select all

Index: pc/Makefile
===================================================================
--- pc/Makefile (revision 2252)
+++ pc/Makefile (working copy)
@@ -10,7 +10,7 @@
        $(LINK.c) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

 %.h: ../pspstub/%.elf
-       bin2c $^ $@ pspstub
+       ../bin2c/bin2c $^ $@ pspstub

 clean:
        rm -f $(OUTPUT) pspstub.h
Index: Makefile
===================================================================
--- Makefile    (revision 2252)
+++ Makefile    (working copy)
@@ -1,7 +1,16 @@
+PSPSDK=$(shell psp-config --pspsdk-path)
+PSPDIR=$(shell psp-config --psp-prefix)
+
 all:
+       $(MAKE) -C bin2c
        $(MAKE) -C pspstub
        $(MAKE) -C pc

+install: all
+       @echo "Installing psp-packer into $(PSPDIR)/bin"
+       @cp pc/psp-packer $(PSPDIR)/bin
+
 clean:
+       $(MAKE) -C bin2c clean
        $(MAKE) -C pspstub clean
        $(MAKE) -C pc clean
Index: bin2c/Makefile
===================================================================
--- bin2c/Makefile      (revision 0)
+++ bin2c/Makefile      (revision 0)
@@ -0,0 +1,12 @@
+OUTPUT=bin2c
+
+all: $(OUTPUT)
+
+CFLAGS=-Wall
+
+$(OUTPUT): $(OUTPUT).c
+       $(LINK.c) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+clean:
+       rm -f $(OUTPUT)
+

Property changes on: bin2c/Makefile
___________________________________________________________________
Name: svn:eol-style
   + native

Index: bin2c/bin2c.c
===================================================================
--- bin2c/bin2c.c       (revision 0)
+++ bin2c/bin2c.c       (revision 0)
@@ -0,0 +1,68 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+int main&#40;int argc, char *argv&#91;&#93;&#41;
+&#123;
+       uint32_t fsize;
+       int lcount;
+       uint8_t c;
+
+       FILE *fp;
+       FILE *ofp;
+
+       if&#40;argc<4&#41;
+       &#123;
+               printf&#40;"bin2c inputfile outputfile recordname\n"&#41;;
+               exit&#40;0&#41;;
+       &#125;
+
+       ofp = fopen&#40;argv&#91;2&#93;, "wt"&#41;;
+       if&#40;ofp != NULL&#41;
+       &#123;
+               fp = fopen&#40;argv&#91;1&#93;, "rb"&#41;;
+               if&#40;fp!=NULL&#41;
+               &#123;
+                       fseek&#40;fp, 0x0L, SEEK_END&#41;;
+                       fsize = ftell&#40;fp&#41;;
+                       fseek&#40;fp, 0x0L, SEEK_SET&#41;;
+
+                       lcount = 0;
+
+                       fprintf&#40;ofp, "unsigned long size_%s=%i;\n", argv&#91;3&#93;, fsize&#41;;
+                       fprintf&#40;ofp, "unsigned char %s&#91;&#93;=\n&#123;\n\t", argv&#91;3&#93;&#41;;
+
+                       while&#40;ftell&#40;fp&#41; < fsize&#41;
+                       &#123;
+                               c = fgetc&#40;fp&#41;;
+
+                               if&#40;lcount > 0&#41;
+                                       fprintf&#40;ofp, ", "&#41;;
+
+                               fprintf&#40;ofp, "0x%02X", c&#41;;
+
+                               lcount++;
+                               if&#40;lcount == 10&#41;
+                               &#123;
+                                       lcount = 0;
+                                       fprintf&#40;ofp, ", \n\t"&#41;;
+                               &#125;
+                       &#125;
+                       fclose&#40;fp&#41;;
+                       fprintf&#40;ofp, "\n&#125;;\n"&#41;;
+                       fclose&#40;ofp&#41;;
+               &#125;
+               else
+               &#123;
+                       fprintf&#40;stderr, "Could not open file\n"&#41;;
+               &#125;
+       &#125;
+       else
+       &#123;
+               fprintf&#40;stderr, "Could not open output file\n"&#41;;
+       &#125;
+
+       return 0;
+&#125;
+

Property changes on&#58; bin2c/bin2c.c
___________________________________________________________________
Name&#58; svn&#58;eol-style
   + native
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

This has been added to the repository.
Post Reply