libinjection / libinjection

SQL / SQLI tokenizer parser analyzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: document how to mimic old build for easier migration from client9/libinjection

acestronautical opened this issue · comments

The old makefile would build libinjection.a but with the new autotools system the ability to create a static lib build seems to be missing?

I tried configure --enable-static but that didn't seem to generate libinjection.a

Either this is broken, or I don't understand autotools (which is more likely).

Some documentation around the new autotools system would be much appreciated.

This is because autotools use libtool. You will find libraries in the src/.libs directory, after your make.

❯ find . -name "*.a"
./src/.libs/libinjection.a

If you configure a prefix when configuring, you can find all the files installed:

❯ ./configure --enable-static --prefix=/tmp/mydir
....
❯ make install
...
❯ find /tmp/mydir
/tmp/mydir
/tmp/mydir/include
/tmp/mydir/include/libinjection_sqli.h
/tmp/mydir/include/libinjection_sqli_data.h
/tmp/mydir/include/libinjection.h
/tmp/mydir/include/libinjection_html5.h
/tmp/mydir/include/libinjection_xss.h
/tmp/mydir/lib
/tmp/mydir/lib/pkgconfig
/tmp/mydir/lib/pkgconfig/libinjection.pc
/tmp/mydir/lib/libinjection.a
/tmp/mydir/lib/libinjection.1.dylib
/tmp/mydir/lib/libinjection.la
/tmp/mydir/lib/libinjection.dylib

thank you @fzipi is there any way I can mimic the old way of building where the *.a files were placed alongside the source files in the same directory? I'm trying to upgrade from the client9 version of this repo and the new way of building doesn't integrate with the rest of my build system.

I would try ./configure --enable-static --prefix=./src but I don't think I can do a relative path like that

Assuming you have your files in a folder mybuild, and libinjection is a sibling directory, you can just do cd ../libinjection && ./configure && make && cd ../mybuild and then just link using -L ../libinjection/src/.libs -linjection -static or similar. You get the idea.

Unfortunately that will not work for my situation. I have a rather complex ninja build and it requires the *.a files exist alongside the source code. I could copy them out of the .libs folder to where I need them, but that's pretty gross. Was hoping autotools provided a better way to build in the same way the old system did.

You can always build libinjection first, and assume your build can link to it when installed...

I would rather not change my entire build system in order to update one dependency. This is all in a docker container with reproducible builds. Is there really no way to just build it the way it used to?

Probably. Just translate https://github.com/libinjection/libinjection/blob/main/src/Makefile.am#L11-L24 and this dependency

libinjection_la_SOURCES = libinjection_sqli.c libinjection_html5.c libinjection_xss.c libinjection_sqli_data.h
into ninja.

@fzipi Thank you for your help I have resolved my issue. I was able to commit the results of autogen.sh, modify my build to run configure, then make and pointed my ninja build at the .libs folder.

Hopefully someone can add a little more documentation around this as I expect I am not the only person who will have a hard time switching from client9/libinjection due to the switch to autotools. Feel free to close this issue and thanks again.