File tree 7 files changed +44
-11
lines changed
7 files changed +44
-11
lines changed Original file line number Diff line number Diff line change
1
+ FROM debian
2
+
3
+ RUN apt-get update && apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 libtool pkg-config bzip2 zip make autoconf wget patch git automake flex bison cmake xsltproc && rm -rf /var/lib/apt/lists/*
4
+
5
+ COPY . /avrdude-build-script
6
+
7
+ WORKDIR /avrdude-build-script
8
+
9
+ ENTRYPOINT ["/avrdude-build-script/package-avrdude.bash" ]
Original file line number Diff line number Diff line change @@ -18,6 +18,22 @@ Just run:
18
18
Setup has been done on partially set up development machines.
19
19
If you find any package missing from the following list, please open an issue at once!
20
20
21
+ ### Docker Building
22
+
23
+ Run:
24
+ ```
25
+ mkdir dist
26
+ docker build . -t avrdude-builder
27
+ # cross compile i686
28
+ docker run --rm -it -v $PWD/dist:/avrdude-build-script/dist -e CROSS_COMPILE=mingw avrdude-builder
29
+ # cross compile x86_64
30
+ docker run --rm -it -v $PWD/dist:/avrdude-build-script/dist -e CROSS_COMPILE=mingw64 avrdude-builder
31
+ # remove container
32
+ docker rmi avrdude-builder
33
+ ```
34
+
35
+ If you do not need cross compile, just remove ` -e CROSS_COMPILE=mingw ` .
36
+
21
37
#### Debian requirements
22
38
23
39
``` bash
Original file line number Diff line number Diff line change 40
40
41
41
COMMON_FLAGS=" "
42
42
43
- if [[ $CROSS_COMPILE == " mingw" ]] ; then
44
- CFLAGS=" -DHAVE_LIBHIDAPI $CFLAGS "
45
- LIBS=" -lhidapi -lsetupapi -Wl,-Bstatic -lwinpthread"
46
- fi
47
-
48
- if [[ $OS == " Msys" ]] ; then
43
+ if [[ $CROSS_COMPILE == " mingw" || $CROSS_COMPILE == " mingw64" || $OS == " Msys" ]] ; then
49
44
CFLAGS=" -DHAVE_LIBHIDAPI $CFLAGS "
50
45
LIBS=" -lhidapi -lsetupapi -Wl,-Bstatic -lwinpthread"
51
46
fi
Original file line number Diff line number Diff line change @@ -36,10 +36,14 @@ cd build/
36
36
37
37
CMAKE_EXTRA_FLAG=" -DSHAREDLIBS=OFF -DBUILD_TESTS=OFF"
38
38
39
- if [[ $OS == " GNU/Linux" ]] ; then
39
+ if [[ $OS == " GNU/Linux" && $CROSS_COMPILE == " mingw " ]] ; then
40
40
CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain-i686-w64-mingw32.cmake"
41
41
fi
42
42
43
+ if [[ $OS == " GNU/Linux" && $CROSS_COMPILE == " mingw64" ]] ; then
44
+ CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain-x86_64-w64-mingw32.cmake"
45
+ fi
46
+
43
47
cmake $CMAKE_EXTRA_FLAG -DCMAKE_INSTALL_PREFIX=" $PREFIX " -DLIBUSB_INCLUDE_DIR=" $PREFIX /include/libusb-1.0" -DLIBFTDI_LIBRARY_DIRS=" $PREFIX /lib" -DLIBUSB_LIBRARIES=" usb-1.0" ../
44
48
make -j 1
45
49
make install
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ cd objdir
20
20
PREFIX=` pwd`
21
21
cd -
22
22
23
- if [[ $OS == " Msys" || $OS == " Cygwin" || $CROSS_COMPILE_HOST == " i686-w64-mingw32" || $CROSS_COMPILE_HOST == " aarch64-linux-gnu" ]] ; then
23
+ if [[ $OS == " Msys" || $OS == " Cygwin" || $CROSS_COMPILE_HOST == " i686-w64-mingw32" || $CROSS_COMPILE_HOST == " x86_64-w64-mingw32 " || $CROSS_COMPILE_HOST == " aarch64-linux-gnu" ]] ; then
24
24
# Avoid compiling ncurses in Windows platform
25
25
exit 0
26
26
fi
Original file line number Diff line number Diff line change 41
41
tar xfv libusb-compat-0.1.5.tar.bz2
42
42
43
43
cd libusb-compat-0.1.5
44
- if [[ $OS == " Msys" || $OS == " Cygwin" || $CROSS_COMPILE_HOST == " i686-w64-mingw32" ]] ; then
44
+ if [[ $OS == " Msys" || $OS == " Cygwin" || $CROSS_COMPILE_HOST == " i686-w64-mingw32" || $CROSS_COMPILE_HOST == " x86_64-w64-mingw32 " ]] ; then
45
45
patch -p1 < ../libusb-compat-0.1.5-patches/01-mingw-build.patch
46
46
autoreconf --force --install
47
47
fi
Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ if [[ $CROSS_COMPILE == "mingw" ]] ; then
27
27
export CROSS_COMPILE_HOST=" i686-w64-mingw32"
28
28
export TARGET_OS=" Windows"
29
29
OUTPUT_TAG=i686-w64-mingw32
30
+ elif [[ $CROSS_COMPILE == " mingw64" ]] ; then
31
+
32
+ export CC=" x86_64-w64-mingw32-gcc"
33
+ export CXX=" x86_64-w64-mingw32-g++"
34
+ export CROSS_COMPILE_HOST=" x86_64-w64-mingw32"
35
+ export TARGET_OS=" Windows"
36
+ OUTPUT_TAG=x86_64-w64-mingw32
30
37
31
38
elif [[ $CROSS_COMPILE == " arm64-cross" ]] ; then
32
39
export CC=" aarch64-linux-gnu-gcc"
@@ -109,14 +116,16 @@ if [[ ${OUTPUT_TAG} == *"mingw"* ]] ; then
109
116
# cp libusb-win32-bin-1.2.6.0/bin/x86/libusb0_x86.dll objdir/bin/libusb0.dll
110
117
rm -f avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .zip
111
118
cp -a objdir avrdude
112
- zip -r avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .zip avrdude/bin/ avrdude/etc/avrdude.conf
119
+ mkdir -p dist/
120
+ zip -r dist/avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .zip avrdude/bin/ avrdude/etc/avrdude.conf
113
121
rm -r avrdude
114
122
115
123
else
116
124
117
125
rm -f avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .tar.bz2
118
126
cp -a objdir avrdude
119
- tar -cjvf avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .tar.bz2 avrdude/bin/avrdude avrdude/etc/avrdude.conf
127
+ mkdir -p dist/
128
+ tar -cjvf dist/avrdude-${OUTPUT_VERSION} -${OUTPUT_TAG} .tar.bz2 avrdude/bin/avrdude avrdude/etc/avrdude.conf
120
129
rm -r avrdude
121
130
122
131
fi
You can’t perform that action at this time.
0 commit comments