[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to build packages from tarballs without makefiles



On Sun, Apr 09, 2006 at 01:20:06AM -0700, David Liontooth wrote:
> Roberto C. Sanchez wrote:
> >David Liontooth wrote:
> >  
> >>I occasionally run into tarballs without a makefile. How do I turn those
> >>into Debian packages?
> >>
> >>Here's an example -- otk_lib from http://otk.sourceforge.net/.
> >>
> >># tar zxvf otk_lib_0.47.tgz
> >>otk_lib/gadget_lib.c
> >>otk_lib/letter2vector2.c
> >>otk_lib/otk_lib.c
> >>otk_lib/Readme.txt
> >>otk_lib/gadget_lib.h
> >>otk_lib/otk_lib.h
> >>
> >>I rename the directory libotk-0.47, enter it, and run dh_make -s,
> >>getting "Currently there is no top level Makefile." The Readme.txt says
> >>
> >>/* To Compile:   Directive in code should detect environment and do the
> >>right thing.    */
> >>/* 
> >>Unix/Linux:                                                               
> >>*/
> >>/*        cc -O -c -I/usr/X11R6/include otk_lib.c -o
> >>otk.o                              */
> >>/*    Link with:    -lGLU -lGL -lXmu -lXext
> >>-lX11                                       */
> >>
> >>Do I put these into debian/rules? Where?
> >>
> >>I was hoping I could make a few changes and run fakeroot 
> >>dpkg-buildpackage.
> >>
> >>Dave
> >
> >I would just put those into the debian/rules.  There is not enough there
> >to justify a full-blown makefile in my mind.
You could write a nice 5 line Makefile and send it upstream, or you
could stuff the upstream README into debian/rules.

> OK, that's good news, but I need a bit more help -- where do I add them 
> to rules?
See policy for the required targets.  Compiled sources are
arch-dependendent.

>    CFLAGS = -Wall -g
> 
> Can I add the "Link with" line to give
You shouldn't; there are CPPFLAGS for the preprocessor, and LDFLAGS
for the linker.

>   CFLAGS = -Wall -g -lGLU -lGL -lXmu -lXext -lX11
Use LDLIBS instead.

> Does that work?
Yes but..

> What about
> 
> -O -c -I/usr/X11R6/include otk_lib.c -o
-O is another CFLAG.  make should take care of -c and -o
automatically, from the rule database that knows how to compile .c to
.o and .o to ELF.

> Under "# Add here commands to compile the package." I just have 
> 
>        $(MAKE)
> 
> I don't know the syntax here.
MAKE is a variable, $(MAKE) is the contents of that variable.  You
could run make -asdf -f ./debian/rules, and the "-asdf" would be
preserved in the sub-make.

You should read the gnu make manual:
  http://www.gnu.org/software/make/manual/make.html

Justin



Reply to: