libmpsse
libmpsse copied to clipboard
Add standalone libftdi1 library
Dear @l29ah thanks a lot for maintaining this library. Here's another big PR for usability: I'm making an attempt to make the library more mainstream to use by adding a static build of libftdi1, libusb and libconfuse included as a whole archive to libmpsse (libmpsse-static.a). This means that the user only needs to link -lpthread and -ludev and should be ready to go.
I've updated the readme with the new build instruction, but you just have to run build.sh
. Let me know your feedback.
Here's the main changed I did to source code files:
- Removed the latency_timer range from
libftdi
to allow ft2232h devices to be used with "0" ms latency timer. - Changed
config.h
tompsse_config.h
. This avoids conflict with other projects which already uses config.h for something else. - Modified configure.ac to use the static libftdi library.
- Updated the CI file (.travis.yml) to use ./build.sh instead
MISC
How to generate libftdi1-static.a
-
Clone repositories
libusb
andlibconfuse-2.5
and compile them to get their static libraries: -
Configure libftdi as follows adding the correct path to each library static libraries and header folders:
cmake -B build -DLIBUSB_LIBRARIES=`pwd`/libusb-1.0.a \
-DLIBUSB_INCLUDE_DIR=`pwd`/libusb/libusb \
-DCONFUSE_LIBRARY=`pwd`/libconfuse.a \
-DCONFUSE_INCLUDE_DIR=`pwd`/confuse-2.5/src \
-DFTDIPP=ON \
-DCMAKE_BUILD_TYPE=Release
make -C build ftdi1-static
- Use
ar -x libftdi1.a && ar -x libconfuse.a && ar -x libusb.a
to extract all object files - Use
ar -qc libftdi1-static.a *.o
to create ftdi static library - Copy the generated libftdi1-static.a to libmpsse src folder.
Sorry i didn't notice your PR.
You shouldn't commit generated files into the repo. Also the commits must be atomic, so git bisect
and other workflows make sense.
thanks, @l29ah and noted.
- I can solve the issue with generated file by including all steps to generate the static libraries on build.sh. I wonder if you prefer to include libftdi and linconfuse-2.5 as submodules or simply handle everything by cloning them on build.sh?
- I'll do a force push with the atomic commit then.
- I see a lot of formatting was changed due to VSCode, do you have the clang-format file to enforce the correct automatic formatting for this repo?
Do you have some feedback on the code changes itself?
I prefer the build system to take the dependencies from the running system, as it does now.
No, and i would prefer not to touch the formatting for some time to maintain compatibility with people's patches to the original libmpsse, even though the current style is horrible.
And i probably can't even tell what "the code changes itself" are among the automatically generated stuff and questionable scripts.
@l29ah thanks for the feedback and sorry for the trouble. I'll fix this PR when I get the chance. Since you prefer to link with system dependencies, would a build script which generates both the normal library and the standalone be an acceptable solution for the final PR?