* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package [not found] <CAPeEpDpMY2sRjGdd+TgPz5S--Pws+5hUNrV8jpiznxBqFZ7zDg@mail.gmail.com> @ 2013-07-11 5:17 ` Guillermo A. Amaral 2013-07-11 5:19 ` Guillermo A. Amaral 0 siblings, 1 reply; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-11 5:17 UTC (permalink / raw) To: buildroot From: "Guillermo A. Amaral" <g@maral.me> Signed-off-by: Guillermo A. Amaral <g@maral.me> --- package/Config.in | 1 + package/wiringpi/Config.in | 8 ++ package/wiringpi/wiringpi-CLOEXEC-undefined.patch | 28 +++++ package/wiringpi/wiringpi-cmake-support.patch | 122 ++++++++++++++++++++++ package/wiringpi/wiringpi.mk | 14 +++ 5 files changed, 173 insertions(+) create mode 100644 package/wiringpi/Config.in create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch create mode 100644 package/wiringpi/wiringpi-cmake-support.patch create mode 100644 package/wiringpi/wiringpi.mk diff --git a/package/Config.in b/package/Config.in index 3186bb7..2824904 100644 --- a/package/Config.in +++ b/package/Config.in @@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in" source "package/usbmount/Config.in" source "package/usbutils/Config.in" source "package/wipe/Config.in" +source "package/wiringpi/Config.in" source "package/w_scan/Config.in" endmenu diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in new file mode 100644 index 0000000..f368bf7 --- /dev/null +++ b/package/wiringpi/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_WIRINGPI + bool "wiringpi" + depends on BR2_arm + help + GPIO Interface library for the Raspberry Pi. + + http://wiringpi.com/ + diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file mode 100644 index 0000000..e023d15 --- /dev/null +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch @@ -0,0 +1,28 @@ +From 728b2634cbf661e5303b1e8cb791b909ad4e907c Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:05:12 -0700 +Subject: [PATCH] Declare O_CLOEXEC on systems with an older kernel and/or + glibc. + +--- + wiringPi/wiringPi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c +index ba61d9f..2ee23b9 100644 +--- a/wiringPi/wiringPi.c ++++ b/wiringPi/wiringPi.c +@@ -77,6 +77,10 @@ + #define FALSE (1==2) + #endif + ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ + // Environment Variables + + #define ENV_DEBUG "WIRINGPI_DEBUG" +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi-cmake-support.patch b/package/wiringpi/wiringpi-cmake-support.patch new file mode 100644 index 0000000..05ccd72 --- /dev/null +++ b/package/wiringpi/wiringpi-cmake-support.patch @@ -0,0 +1,122 @@ +From 8feae03a9b77f4a4504d00423d70d318ee08296a Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:02:44 -0700 +Subject: [PATCH] CMake support for WiringPi + + +Signed-off-by: Guillermo A. Amaral <g@maral.me> +--- + CMakeLists.txt | 9 +++++++++ + devLib/CMakeLists.txt | 27 +++++++++++++++++++++++++++ + gpio/CMakeLists.txt | 20 ++++++++++++++++++++ + wiringPi/CMakeLists.txt | 21 +++++++++++++++++++++ + 4 files changed, 77 insertions(+) + create mode 100644 CMakeLists.txt + create mode 100644 devLib/CMakeLists.txt + create mode 100644 gpio/CMakeLists.txt + create mode 100644 wiringPi/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..324ccff +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,9 @@ ++cmake_minimum_required(VERSION 2.8) ++ ++project(wiringPi) ++ ++set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared objects") ++ ++add_subdirectory(wiringPi) ++add_subdirectory(devLib) ++add_subdirectory(gpio) +diff --git a/devLib/CMakeLists.txt b/devLib/CMakeLists.txt +new file mode 100644 +index 0000000..6a7199d +--- /dev/null ++++ b/devLib/CMakeLists.txt +@@ -0,0 +1,27 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(devLib_SOVERSION "2.0") ++set(devLib_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB devLib_SRCS *.c) ++file(GLOB devLib_HDRS *.h) ++list(REMOVE_ITEM devLib_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/piFaceOld.c) ++ ++find_library(PTHREAD_LIBRARY pthread) ++ ++include_directories("../wiringPi") ++ ++add_library(wiringPiDev ${devLib_SRCS}) ++target_link_libraries(wiringPiDev ${PTHREAD_LIBRARY}) ++set_target_properties(wiringPiDev PROPERTIES COMPILE_FLAGS ${devLib_CFLAGS}) ++set_target_properties(wiringPiDev PROPERTIES SOVERSION ${devLib_SOVERSION}) ++ ++install(TARGETS wiringPiDev ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${devLib_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt +new file mode 100644 +index 0000000..a39e511 +--- /dev/null ++++ b/gpio/CMakeLists.txt +@@ -0,0 +1,20 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(gpio_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB gpio_SRCS *.c) ++ ++include_directories("../wiringPi") ++include_directories("../devLib") ++ ++find_library(M_LIBRARY m) ++find_library(PTHREAD_LIBRARY pthread) ++ ++add_executable(gpio ${gpio_SRCS}) ++target_link_libraries(gpio ${M_LIBRARY} ${PTHREAD_LIBRARY} wiringPi wiringPiDev) ++set_target_properties(gpio PROPERTIES COMPILE_FLAGS ${gpio_CFLAGS}) ++ ++install(TARGETS gpio ++ RUNTIME DESTINATION bin COMPONENT target ++) ++ +diff --git a/wiringPi/CMakeLists.txt b/wiringPi/CMakeLists.txt +new file mode 100644 +index 0000000..e54eaf6 +--- /dev/null ++++ b/wiringPi/CMakeLists.txt +@@ -0,0 +1,21 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(wiringPi_SOVERSION "2.0") ++set(wiringPi_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB wiringPi_SRCS *.c) ++file(GLOB wiringPi_HDRS *.h) ++ ++add_library(wiringPi ${wiringPi_SRCS}) ++set_target_properties(wiringPi PROPERTIES COMPILE_FLAGS ${wiringPi_CFLAGS}) ++set_target_properties(wiringPi PROPERTIES SOVERSION ${wiringPi_SOVERSION}) ++ ++install(TARGETS wiringPi ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${wiringPi_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk new file mode 100644 index 0000000..4341f49 --- /dev/null +++ b/package/wiringpi/wiringpi.mk @@ -0,0 +1,14 @@ +############################################################# +# +# wiringpi +# +############################################################# + +WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6 +WIRINGPI_SITE = git://git.drogon.net/wiringPi +WIRINGPI_LICENSE = LGPLv3+ +WIRINGPI_LICENSE_FILES = COPYING.LESSER +WIRINGPI_INSTALL_STAGING = YES +WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release + +$(eval $(cmake-package)) -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 5:17 ` [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package Guillermo A. Amaral @ 2013-07-11 5:19 ` Guillermo A. Amaral 2013-07-11 5:33 ` Baruch Siach 0 siblings, 1 reply; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-11 5:19 UTC (permalink / raw) To: buildroot From: "Guillermo A. Amaral" <g@maral.me> Signed-off-by: Guillermo A. Amaral <g@maral.me> --- package/Config.in | 1 + package/wiringpi/Config.in | 8 ++ package/wiringpi/wiringpi-CLOEXEC-undefined.patch | 29 +++++ package/wiringpi/wiringpi-cmake-support.patch | 122 ++++++++++++++++++++++ package/wiringpi/wiringpi.mk | 14 +++ 5 files changed, 174 insertions(+) create mode 100644 package/wiringpi/Config.in create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch create mode 100644 package/wiringpi/wiringpi-cmake-support.patch create mode 100644 package/wiringpi/wiringpi.mk diff --git a/package/Config.in b/package/Config.in index 3186bb7..2824904 100644 --- a/package/Config.in +++ b/package/Config.in @@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in" source "package/usbmount/Config.in" source "package/usbutils/Config.in" source "package/wipe/Config.in" +source "package/wiringpi/Config.in" source "package/w_scan/Config.in" endmenu diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in new file mode 100644 index 0000000..f368bf7 --- /dev/null +++ b/package/wiringpi/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_WIRINGPI + bool "wiringpi" + depends on BR2_arm + help + GPIO Interface library for the Raspberry Pi. + + http://wiringpi.com/ + diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file mode 100644 index 0000000..ca0ed99 --- /dev/null +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch @@ -0,0 +1,29 @@ +From 728b2634cbf661e5303b1e8cb791b909ad4e907c Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:05:12 -0700 +Subject: [PATCH] Declare O_CLOEXEC on systems with an older kernel and/or + glibc. + +Signed-off-by: Guillermo A. Amaral <g@maral.me> +--- + wiringPi/wiringPi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c +index ba61d9f..2ee23b9 100644 +--- a/wiringPi/wiringPi.c ++++ b/wiringPi/wiringPi.c +@@ -77,6 +77,10 @@ + #define FALSE (1==2) + #endif + ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ + // Environment Variables + + #define ENV_DEBUG "WIRINGPI_DEBUG" +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi-cmake-support.patch b/package/wiringpi/wiringpi-cmake-support.patch new file mode 100644 index 0000000..05ccd72 --- /dev/null +++ b/package/wiringpi/wiringpi-cmake-support.patch @@ -0,0 +1,122 @@ +From 8feae03a9b77f4a4504d00423d70d318ee08296a Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:02:44 -0700 +Subject: [PATCH] CMake support for WiringPi + + +Signed-off-by: Guillermo A. Amaral <g@maral.me> +--- + CMakeLists.txt | 9 +++++++++ + devLib/CMakeLists.txt | 27 +++++++++++++++++++++++++++ + gpio/CMakeLists.txt | 20 ++++++++++++++++++++ + wiringPi/CMakeLists.txt | 21 +++++++++++++++++++++ + 4 files changed, 77 insertions(+) + create mode 100644 CMakeLists.txt + create mode 100644 devLib/CMakeLists.txt + create mode 100644 gpio/CMakeLists.txt + create mode 100644 wiringPi/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..324ccff +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,9 @@ ++cmake_minimum_required(VERSION 2.8) ++ ++project(wiringPi) ++ ++set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared objects") ++ ++add_subdirectory(wiringPi) ++add_subdirectory(devLib) ++add_subdirectory(gpio) +diff --git a/devLib/CMakeLists.txt b/devLib/CMakeLists.txt +new file mode 100644 +index 0000000..6a7199d +--- /dev/null ++++ b/devLib/CMakeLists.txt +@@ -0,0 +1,27 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(devLib_SOVERSION "2.0") ++set(devLib_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB devLib_SRCS *.c) ++file(GLOB devLib_HDRS *.h) ++list(REMOVE_ITEM devLib_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/piFaceOld.c) ++ ++find_library(PTHREAD_LIBRARY pthread) ++ ++include_directories("../wiringPi") ++ ++add_library(wiringPiDev ${devLib_SRCS}) ++target_link_libraries(wiringPiDev ${PTHREAD_LIBRARY}) ++set_target_properties(wiringPiDev PROPERTIES COMPILE_FLAGS ${devLib_CFLAGS}) ++set_target_properties(wiringPiDev PROPERTIES SOVERSION ${devLib_SOVERSION}) ++ ++install(TARGETS wiringPiDev ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${devLib_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt +new file mode 100644 +index 0000000..a39e511 +--- /dev/null ++++ b/gpio/CMakeLists.txt +@@ -0,0 +1,20 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(gpio_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB gpio_SRCS *.c) ++ ++include_directories("../wiringPi") ++include_directories("../devLib") ++ ++find_library(M_LIBRARY m) ++find_library(PTHREAD_LIBRARY pthread) ++ ++add_executable(gpio ${gpio_SRCS}) ++target_link_libraries(gpio ${M_LIBRARY} ${PTHREAD_LIBRARY} wiringPi wiringPiDev) ++set_target_properties(gpio PROPERTIES COMPILE_FLAGS ${gpio_CFLAGS}) ++ ++install(TARGETS gpio ++ RUNTIME DESTINATION bin COMPONENT target ++) ++ +diff --git a/wiringPi/CMakeLists.txt b/wiringPi/CMakeLists.txt +new file mode 100644 +index 0000000..e54eaf6 +--- /dev/null ++++ b/wiringPi/CMakeLists.txt +@@ -0,0 +1,21 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(wiringPi_SOVERSION "2.0") ++set(wiringPi_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB wiringPi_SRCS *.c) ++file(GLOB wiringPi_HDRS *.h) ++ ++add_library(wiringPi ${wiringPi_SRCS}) ++set_target_properties(wiringPi PROPERTIES COMPILE_FLAGS ${wiringPi_CFLAGS}) ++set_target_properties(wiringPi PROPERTIES SOVERSION ${wiringPi_SOVERSION}) ++ ++install(TARGETS wiringPi ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${wiringPi_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk new file mode 100644 index 0000000..4341f49 --- /dev/null +++ b/package/wiringpi/wiringpi.mk @@ -0,0 +1,14 @@ +############################################################# +# +# wiringpi +# +############################################################# + +WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6 +WIRINGPI_SITE = git://git.drogon.net/wiringPi +WIRINGPI_LICENSE = LGPLv3+ +WIRINGPI_LICENSE_FILES = COPYING.LESSER +WIRINGPI_INSTALL_STAGING = YES +WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release + +$(eval $(cmake-package)) -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 5:19 ` Guillermo A. Amaral @ 2013-07-11 5:33 ` Baruch Siach 2013-07-11 6:00 ` Guillermo A. Amaral 0 siblings, 1 reply; 16+ messages in thread From: Baruch Siach @ 2013-07-11 5:33 UTC (permalink / raw) To: buildroot Hi Guillermo, On Wed, Jul 10, 2013 at 10:19:20PM -0700, Guillermo A. Amaral wrote: > From: "Guillermo A. Amaral" <g@maral.me> > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > --- [...] > diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > new file mode 100644 > index 0000000..ca0ed99 > --- /dev/null > +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > @@ -0,0 +1,29 @@ > +From 728b2634cbf661e5303b1e8cb791b909ad4e907c Mon Sep 17 00:00:00 2001 > +From: "Guillermo A. Amaral" <g@maral.me> > +Date: Wed, 10 Jul 2013 22:05:12 -0700 > +Subject: [PATCH] Declare O_CLOEXEC on systems with an older kernel and/or > + glibc. > + > +Signed-off-by: Guillermo A. Amaral <g@maral.me> > +--- > + wiringPi/wiringPi.c | 4 ++++ > + 1 file changed, 4 insertions(+) > + > +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c > +index ba61d9f..2ee23b9 100644 > +--- a/wiringPi/wiringPi.c > ++++ b/wiringPi/wiringPi.c > +@@ -77,6 +77,10 @@ > + #define FALSE (1==2) > + #endif > + > ++#ifndef O_CLOEXEC > ++#define O_CLOEXEC 0 Are you sure? I see #define O_CLOEXEC 02000000 in include/uapi/asm-generic/fcntl.h. baruch > ++#endif > ++ > + // Environment Variables > + > + #define ENV_DEBUG "WIRINGPI_DEBUG" > +-- -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 5:33 ` Baruch Siach @ 2013-07-11 6:00 ` Guillermo A. Amaral 2013-07-11 6:04 ` Baruch Siach 0 siblings, 1 reply; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-11 6:00 UTC (permalink / raw) To: buildroot On Thu, Jul 11, 2013 at 08:33:59AM +0300, Baruch Siach wrote: > Hi Guillermo, > > On Wed, Jul 10, 2013 at 10:19:20PM -0700, Guillermo A. Amaral wrote: > > From: "Guillermo A. Amaral" <g@maral.me> > > > > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > > --- > > [...] > > > diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > > b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > > new file mode 100644 > > index 0000000..ca0ed99 > > --- /dev/null > > +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > > @@ -0,0 +1,29 @@ > > +From 728b2634cbf661e5303b1e8cb791b909ad4e907c Mon Sep 17 00:00:00 2001 > > +From: "Guillermo A. Amaral" <g@maral.me> > > +Date: Wed, 10 Jul 2013 22:05:12 -0700 > > +Subject: [PATCH] Declare O_CLOEXEC on systems with an older kernel and/or > > + glibc. > > + > > +Signed-off-by: Guillermo A. Amaral <g@maral.me> > > +--- > > + wiringPi/wiringPi.c | 4 ++++ > > + 1 file changed, 4 insertions(+) > > + > > +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c > > +index ba61d9f..2ee23b9 100644 > > +--- a/wiringPi/wiringPi.c > > ++++ b/wiringPi/wiringPi.c > > +@@ -77,6 +77,10 @@ > > + #define FALSE (1==2) > > + #endif > > + > > ++#ifndef O_CLOEXEC > > ++#define O_CLOEXEC 0 > > Are you sure? I see > > #define O_CLOEXEC 02000000 > > in include/uapi/asm-generic/fcntl.h. > Hi baruch, Usage of O_CLOEXEC in wiringPi was added very recently, it started failing after that. I hear it still works if you're using glibc though (I haven't tested it). Here's the output if you remove the patch: /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c: In function ?wiringPiSetup?: /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: error: ?O_CLOEXEC? undeclared (first use in this function) /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [wiringPi/CMakeFiles/wiringPi.dir/wiringPi.c.o] Error 1 make[1]: *** [wiringPi/CMakeFiles/wiringPi.dir/all] Error 2 make: *** [all] Error 2 Cheers, G -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 6:00 ` Guillermo A. Amaral @ 2013-07-11 6:04 ` Baruch Siach 2013-07-11 6:38 ` Guillermo A. Amaral 0 siblings, 1 reply; 16+ messages in thread From: Baruch Siach @ 2013-07-11 6:04 UTC (permalink / raw) To: buildroot Hi Guillermo, On Wed, Jul 10, 2013 at 11:00:08PM -0700, Guillermo A. Amaral wrote: > On Thu, Jul 11, 2013 at 08:33:59AM +0300, Baruch Siach wrote: > > On Wed, Jul 10, 2013 at 10:19:20PM -0700, Guillermo A. Amaral wrote: > > > From: "Guillermo A. Amaral" <g@maral.me> > > > > > > > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > > > --- [...] > > > ++#ifndef O_CLOEXEC > > > ++#define O_CLOEXEC 0 > > > > Are you sure? I see > > > > #define O_CLOEXEC 02000000 > > > > in include/uapi/asm-generic/fcntl.h. > > > > Hi baruch, > > Usage of O_CLOEXEC in wiringPi was added very recently, it started failing > after that. I hear it still works if you're using glibc though (I haven't > tested it). > > Here's the output if you remove the patch: > > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c: In function ?wiringPiSetup?: > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: error: ?O_CLOEXEC? undeclared (first use in this function) > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: note: each undeclared identifier is reported only once for each function it appears in > make[2]: *** [wiringPi/CMakeFiles/wiringPi.dir/wiringPi.c.o] Error 1 > make[1]: *** [wiringPi/CMakeFiles/wiringPi.dir/all] Error 2 > make: *** [all] Error 2 I didn't say you should remove this patch, just use the correct value. Setting O_CLOEXEC to 0 makes it effectively a no-op. Is this intended? baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 6:04 ` Baruch Siach @ 2013-07-11 6:38 ` Guillermo A. Amaral 2013-07-11 7:42 ` Carsten Schoenert 0 siblings, 1 reply; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-11 6:38 UTC (permalink / raw) To: buildroot On Thu, Jul 11, 2013 at 09:04:19AM +0300, Baruch Siach wrote: > Hi Guillermo, > > On Wed, Jul 10, 2013 at 11:00:08PM -0700, Guillermo A. Amaral wrote: > > On Thu, Jul 11, 2013 at 08:33:59AM +0300, Baruch Siach wrote: > > > On Wed, Jul 10, 2013 at 10:19:20PM -0700, Guillermo A. Amaral wrote: > > > > From: "Guillermo A. Amaral" <g@maral.me> > > > > > > > > > > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > > > > --- > > [...] > > > > > ++#ifndef O_CLOEXEC > > > > ++#define O_CLOEXEC 0 > > > > > > Are you sure? I see > > > > > > #define O_CLOEXEC 02000000 > > > > > > in include/uapi/asm-generic/fcntl.h. > > > > > > > Hi baruch, > > > > Usage of O_CLOEXEC in wiringPi was added very recently, it started failing > > after that. I hear it still works if you're using glibc though (I haven't > > tested it). > > > > Here's the output if you remove the patch: > > > > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c: In function ?wiringPiSetup?: > > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: error: ?O_CLOEXEC? undeclared (first use in this function) > > /development/test/build/wiringpi-02a3bd8d8f2ae5c873e63875a8faef5b627f9db6/wiringPi/wiringPi.c:1544:49: note: each undeclared identifier is reported only once for each function it appears in > > make[2]: *** [wiringPi/CMakeFiles/wiringPi.dir/wiringPi.c.o] Error 1 > > make[1]: *** [wiringPi/CMakeFiles/wiringPi.dir/all] Error 2 > > make: *** [all] Error 2 > > I didn't say you should remove this patch, just use the correct value. Setting > O_CLOEXEC to 0 makes it effectively a no-op. Is this intended? Sorry baruch, I thought you where asking it if was required. -.-' I searched around for alternative ways around the issue when I first encountered it, it seemed no-oping it would be most portable/safest approach. Since, if it's not defined, it might be for a reason, the outcome of setting it to 02000000 would also be unknown. G -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 6:38 ` Guillermo A. Amaral @ 2013-07-11 7:42 ` Carsten Schoenert 2013-07-11 17:55 ` Guillermo Amaral 0 siblings, 1 reply; 16+ messages in thread From: Carsten Schoenert @ 2013-07-11 7:42 UTC (permalink / raw) To: buildroot Hello Guillermo, Am 11.07.2013 08:38, schrieb Guillermo A. Amaral: > I searched around for alternative ways around the issue when I first > encountered it, it seemed no-oping it would be most portable/safest approach. The O_CLOEXEC variable was introduced in 2.6.23. > O_CLOEXEC (Since Linux 2.6.23) > Enable the close-on-exec flag for the new file descriptor. > Specifying this flag permits a program to avoid additional > fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. > Additionally, use of this flag is essential in some > multithreaded programs since using a separate fcntl(2) F_SETFD > operation to set the FD_CLOEXEC flag does not suffice to avoid > race conditions where one thread opens a file descriptor at > the same time as another thread does a fork(2) plus execve(2). So if you use a kernel less then 2.6.23 it make no sense to define O_CLOEXEC to whatever you want, the kernel doesn't know this. And in the opposite you can't defined it to some different then already defined for O_CLOEXEC. The function 'open' can also used without the 3rd parameter. So I think you have to check which kernel version is used and build a patch which does something like #ifdef KERNEL_VER < 2_6_23 if ((fd = open ("/dev/mem", O_RDWR | O_SYNC) ) < 0) #else if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0) #endif The guys from linux-wireless do a lot of this to get the wireless package working om different kernel versions. Regards Carsten ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 7:42 ` Carsten Schoenert @ 2013-07-11 17:55 ` Guillermo Amaral 2013-07-11 18:06 ` Baruch Siach 0 siblings, 1 reply; 16+ messages in thread From: Guillermo Amaral @ 2013-07-11 17:55 UTC (permalink / raw) To: buildroot Howdy Carsten, On Thu, Jul 11, 2013 at 09:42:28AM +0200, Carsten Schoenert wrote: > Hello Guillermo, > > Am 11.07.2013 08:38, schrieb Guillermo A. Amaral: > > I searched around for alternative ways around the issue when I first > > encountered it, it seemed no-oping it would be most portable/safest approach. > > The O_CLOEXEC variable was introduced in 2.6.23. > > > O_CLOEXEC (Since Linux 2.6.23) > > Enable the close-on-exec flag for the new file descriptor. > > Specifying this flag permits a program to avoid additional > > fcntl(2) F_SETFD operations to set the FD_CLOEXEC flag. > > Additionally, use of this flag is essential in some > > multithreaded programs since using a separate fcntl(2) F_SETFD > > operation to set the FD_CLOEXEC flag does not suffice to avoid > > race conditions where one thread opens a file descriptor at > > the same time as another thread does a fork(2) plus execve(2). > > So if you use a kernel less then 2.6.23 it make no sense to definess then 2.6.23 it make no sense to define > O_CLOEXEC to whatever you want, the kernel doesn't know this. And in the > opposite you can't defined it to some different then already defined for > O_CLOEXEC. > > The function 'open' can also used without the 3rd parameter. > > So I think you have to check which kernel version is used and build a > patch which does something like > > #ifdef KERNEL_VER < 2_6_23 > if ((fd = open ("/dev/mem", O_RDWR | O_SYNC) ) < 0) > #else > if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0) > #endif > > The guys from linux-wireless do a lot of this to get the wireless > package working om dif The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is 3.2.27. :) So there should be no need to do the kernel check, since the package is RPi specific. The problem here was that O_CLOEXEC was not defined with the default uclibc and older versions of glibc. Cheers, G -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 17:55 ` Guillermo Amaral @ 2013-07-11 18:06 ` Baruch Siach 2013-07-11 18:22 ` Guillermo Amaral 0 siblings, 1 reply; 16+ messages in thread From: Baruch Siach @ 2013-07-11 18:06 UTC (permalink / raw) To: buildroot Hi Guillermo, On Thu, Jul 11, 2013 at 10:55:30AM -0700, Guillermo Amaral wrote: > The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is > 3.2.27. :) If this is the case, then there is no reason to make O_CLOEXEC a no-op. > So there should be no need to do the kernel check, since the package is RPi > specific. > > The problem here was that O_CLOEXEC was not defined with the default uclibc > and older versions of glibc. The O_CLOEXEC define comes with the kernel headers used to build the toolchain, not from the C library. baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 18:06 ` Baruch Siach @ 2013-07-11 18:22 ` Guillermo Amaral 2013-07-12 3:24 ` Baruch Siach 0 siblings, 1 reply; 16+ messages in thread From: Guillermo Amaral @ 2013-07-11 18:22 UTC (permalink / raw) To: buildroot Hey Baruch, On Thu, Jul 11, 2013 at 09:06:03PM +0300, Baruch Siach wrote: > Hi Guillermo, > > On Thu, Jul 11, 2013 at 10:55:30AM -0700, Guillermo Amaral wrote: > > The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is > > 3.2.27. :) > > If this is the case, then there is no reason to make O_CLOEXEC a no-op. > > > So there should be no need to do the kernel check, since the package is RPi > > specific. > > > > The problem here was that O_CLOEXEC was not defined with the default uclibc > > and older versions of glibc. > > The O_CLOEXEC define comes with the kernel headers used to build the > toolchain, not from the C library. > I didn't say it didn't. I'll clarify, if __USE_GNU and/or __USE_XOPEN2K8 don't get defined at some point O_CLOEXEC is not getting defined. My guess is that they get defined by *libc, feel free to correct me if I'm wrong. G -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-11 18:22 ` Guillermo Amaral @ 2013-07-12 3:24 ` Baruch Siach 2013-07-12 4:30 ` Guillermo Amaral 0 siblings, 1 reply; 16+ messages in thread From: Baruch Siach @ 2013-07-12 3:24 UTC (permalink / raw) To: buildroot Hi Guillermo, On Thu, Jul 11, 2013 at 11:22:58AM -0700, Guillermo Amaral wrote: > On Thu, Jul 11, 2013 at 09:06:03PM +0300, Baruch Siach wrote: > > On Thu, Jul 11, 2013 at 10:55:30AM -0700, Guillermo Amaral wrote: > > > The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is > > > 3.2.27. :) > > > > If this is the case, then there is no reason to make O_CLOEXEC a no-op. > > > > > So there should be no need to do the kernel check, since the package is RPi > > > specific. > > > > > > The problem here was that O_CLOEXEC was not defined with the default uclibc > > > and older versions of glibc. > > > > The O_CLOEXEC define comes with the kernel headers used to build the > > toolchain, not from the C library. > > I didn't say it didn't. I'll clarify, if __USE_GNU and/or __USE_XOPEN2K8 don't > get defined at some point O_CLOEXEC is not getting defined. My guess is that > they get defined by *libc, feel free to correct me if I'm wrong. The code below builds just fine on my machine: #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> void func(void) { open("f", O_RDWR | O_CLOEXEC); } baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-12 3:24 ` Baruch Siach @ 2013-07-12 4:30 ` Guillermo Amaral 2013-07-12 6:47 ` Baruch Siach 0 siblings, 1 reply; 16+ messages in thread From: Guillermo Amaral @ 2013-07-12 4:30 UTC (permalink / raw) To: buildroot Howdy Baruch, On Fri, Jul 12, 2013 at 06:24:30AM +0300, Baruch Siach wrote: > Hi Guillermo, > > On Thu, Jul 11, 2013 at 11:22:58AM -0700, Guillermo Amaral wrote: > > On Thu, Jul 11, 2013 at 09:06:03PM +0300, Baruch Siach wrote: > > > On Thu, Jul 11, 2013 at 10:55:30AM -0700, Guillermo Amaral wrote: > > > > The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is > > > > 3.2.27. :) > > > > > > If this is the case, then there is no reason to make O_CLOEXEC a no-op. > > > > > > > So there should be no need to do the kernel check, since the package is RPi > > > > specific. > > > > > > > > The problem here was that O_CLOEXEC was not defined with the default uclibc > > > > and older versions of glibc. > > > > > > The O_CLOEXEC define comes with the kernel headers used to build the > > > toolchain, not from the C library. > > > > I didn't say it didn't. I'll clarify, if __USE_GNU and/or __USE_XOPEN2K8 don't > > get defined at some point O_CLOEXEC is not getting defined. My guess is that > > they get defined by *libc, feel free to correct me if I'm wrong. > > The code below builds just fine on my machine: > > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > > void func(void) { open("f", O_RDWR | O_CLOEXEC); } Congratulations, I'm very proud. Have a beer on me! (B) G P.S. $ host/usr/bin/arm-linux-gcc -c x.c x.c: In function ?func?: x.c:5:38: error: ?O_CLOEXEC? undeclared (first use in this function) x.c:5:38: note: each undeclared identifier is reported only once for each function it appears in $ cat x.c #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> void func(void) { open("f", O_RDWR | O_CLOEXEC); } -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-12 4:30 ` Guillermo Amaral @ 2013-07-12 6:47 ` Baruch Siach 2013-07-12 6:54 ` Guillermo A. Amaral 0 siblings, 1 reply; 16+ messages in thread From: Baruch Siach @ 2013-07-12 6:47 UTC (permalink / raw) To: buildroot Hi Guillermo, On Thu, Jul 11, 2013 at 09:30:56PM -0700, Guillermo Amaral wrote: > On Fri, Jul 12, 2013 at 06:24:30AM +0300, Baruch Siach wrote: > > On Thu, Jul 11, 2013 at 11:22:58AM -0700, Guillermo Amaral wrote: > > > On Thu, Jul 11, 2013 at 09:06:03PM +0300, Baruch Siach wrote: > > > > On Thu, Jul 11, 2013 at 10:55:30AM -0700, Guillermo Amaral wrote: > > > > > The Raspberry Pi doesn't go down to 2.6.y, the oldest supported version is > > > > > 3.2.27. :) > > > > > > > > If this is the case, then there is no reason to make O_CLOEXEC a no-op. > > > > > > > > > So there should be no need to do the kernel check, since the package is RPi > > > > > specific. > > > > > > > > > > The problem here was that O_CLOEXEC was not defined with the default uclibc > > > > > and older versions of glibc. > > > > > > > > The O_CLOEXEC define comes with the kernel headers used to build the > > > > toolchain, not from the C library. > > > > > > I didn't say it didn't. I'll clarify, if __USE_GNU and/or __USE_XOPEN2K8 don't > > > get defined at some point O_CLOEXEC is not getting defined. My guess is that > > > they get defined by *libc, feel free to correct me if I'm wrong. > > > > The code below builds just fine on my machine: > > > > #include <sys/types.h> > > #include <sys/stat.h> > > #include <fcntl.h> > > > > void func(void) { open("f", O_RDWR | O_CLOEXEC); } > > Congratulations, I'm very proud. Have a beer on me! (B) > > G > > P.S. > > $ host/usr/bin/arm-linux-gcc -c x.c > x.c: In function ?func?: > x.c:5:38: error: ?O_CLOEXEC? undeclared (first use in this function) > x.c:5:38: note: each undeclared identifier is reported only once for each > function it appears in > > $ cat x.c > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > > void func(void) { open("f", O_RDWR | O_CLOEXEC); } And does defining __USE_GNU and/or __USE_XOPEN2K8 improves the situation? My point is that the existence of O_CLOEXEC at build time is determined by the version of the kernel headers in the toolchain. At run time, O_CLOEXEC is effective when the running kernel supports it. The toolchain you are using is based on on old kernel headers, so you need to define O_CLOEXEC yourself, which is fine. The kernel running on a Raspberry Pi should always be recent enough to support O_CLOEXEC. So the right solution, in my opinion, is to define O_CLOEXEC to its real value. baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-12 6:47 ` Baruch Siach @ 2013-07-12 6:54 ` Guillermo A. Amaral 0 siblings, 0 replies; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-12 6:54 UTC (permalink / raw) To: buildroot From: "Guillermo A. Amaral" <g@maral.me> --- package/Config.in | 1 + package/wiringpi/Config.in | 8 ++ package/wiringpi/wiringpi-CLOEXEC-undefined.patch | 29 +++++ package/wiringpi/wiringpi-cmake-support.patch | 122 ++++++++++++++++++++++ package/wiringpi/wiringpi.mk | 14 +++ 5 files changed, 174 insertions(+) create mode 100644 package/wiringpi/Config.in create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch create mode 100644 package/wiringpi/wiringpi-cmake-support.patch create mode 100644 package/wiringpi/wiringpi.mk diff --git a/package/Config.in b/package/Config.in index b588a0c..e4051da 100644 --- a/package/Config.in +++ b/package/Config.in @@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in" source "package/usbmount/Config.in" source "package/usbutils/Config.in" source "package/wipe/Config.in" +source "package/wiringpi/Config.in" source "package/w_scan/Config.in" endmenu diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in new file mode 100644 index 0000000..f368bf7 --- /dev/null +++ b/package/wiringpi/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_WIRINGPI + bool "wiringpi" + depends on BR2_arm + help + GPIO Interface library for the Raspberry Pi. + + http://wiringpi.com/ + diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file mode 100644 index 0000000..fa16636 --- /dev/null +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch @@ -0,0 +1,29 @@ +From 728b2634cbf661e5303b1e8cb791b909ad4e907c Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:05:12 -0700 +Subject: [PATCH] Declare O_CLOEXEC on systems with an older kernel and/or + glibc. + +Signed-off-by: Guillermo A. Amaral <g@maral.me> +--- + wiringPi/wiringPi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c +index ba61d9f..2ee23b9 100644 +--- a/wiringPi/wiringPi.c ++++ b/wiringPi/wiringPi.c +@@ -77,6 +77,10 @@ + #define FALSE (1==2) + #endif + ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 02000000 ++#endif ++ + // Environment Variables + + #define ENV_DEBUG "WIRINGPI_DEBUG" +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi-cmake-support.patch b/package/wiringpi/wiringpi-cmake-support.patch new file mode 100644 index 0000000..05ccd72 --- /dev/null +++ b/package/wiringpi/wiringpi-cmake-support.patch @@ -0,0 +1,122 @@ +From 8feae03a9b77f4a4504d00423d70d318ee08296a Mon Sep 17 00:00:00 2001 +From: "Guillermo A. Amaral" <g@maral.me> +Date: Wed, 10 Jul 2013 22:02:44 -0700 +Subject: [PATCH] CMake support for WiringPi + + +Signed-off-by: Guillermo A. Amaral <g@maral.me> +--- + CMakeLists.txt | 9 +++++++++ + devLib/CMakeLists.txt | 27 +++++++++++++++++++++++++++ + gpio/CMakeLists.txt | 20 ++++++++++++++++++++ + wiringPi/CMakeLists.txt | 21 +++++++++++++++++++++ + 4 files changed, 77 insertions(+) + create mode 100644 CMakeLists.txt + create mode 100644 devLib/CMakeLists.txt + create mode 100644 gpio/CMakeLists.txt + create mode 100644 wiringPi/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..324ccff +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,9 @@ ++cmake_minimum_required(VERSION 2.8) ++ ++project(wiringPi) ++ ++set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared objects") ++ ++add_subdirectory(wiringPi) ++add_subdirectory(devLib) ++add_subdirectory(gpio) +diff --git a/devLib/CMakeLists.txt b/devLib/CMakeLists.txt +new file mode 100644 +index 0000000..6a7199d +--- /dev/null ++++ b/devLib/CMakeLists.txt +@@ -0,0 +1,27 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(devLib_SOVERSION "2.0") ++set(devLib_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB devLib_SRCS *.c) ++file(GLOB devLib_HDRS *.h) ++list(REMOVE_ITEM devLib_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/piFaceOld.c) ++ ++find_library(PTHREAD_LIBRARY pthread) ++ ++include_directories("../wiringPi") ++ ++add_library(wiringPiDev ${devLib_SRCS}) ++target_link_libraries(wiringPiDev ${PTHREAD_LIBRARY}) ++set_target_properties(wiringPiDev PROPERTIES COMPILE_FLAGS ${devLib_CFLAGS}) ++set_target_properties(wiringPiDev PROPERTIES SOVERSION ${devLib_SOVERSION}) ++ ++install(TARGETS wiringPiDev ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${devLib_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt +new file mode 100644 +index 0000000..a39e511 +--- /dev/null ++++ b/gpio/CMakeLists.txt +@@ -0,0 +1,20 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(gpio_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB gpio_SRCS *.c) ++ ++include_directories("../wiringPi") ++include_directories("../devLib") ++ ++find_library(M_LIBRARY m) ++find_library(PTHREAD_LIBRARY pthread) ++ ++add_executable(gpio ${gpio_SRCS}) ++target_link_libraries(gpio ${M_LIBRARY} ${PTHREAD_LIBRARY} wiringPi wiringPiDev) ++set_target_properties(gpio PROPERTIES COMPILE_FLAGS ${gpio_CFLAGS}) ++ ++install(TARGETS gpio ++ RUNTIME DESTINATION bin COMPONENT target ++) ++ +diff --git a/wiringPi/CMakeLists.txt b/wiringPi/CMakeLists.txt +new file mode 100644 +index 0000000..e54eaf6 +--- /dev/null ++++ b/wiringPi/CMakeLists.txt +@@ -0,0 +1,21 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(wiringPi_SOVERSION "2.0") ++set(wiringPi_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB wiringPi_SRCS *.c) ++file(GLOB wiringPi_HDRS *.h) ++ ++add_library(wiringPi ${wiringPi_SRCS}) ++set_target_properties(wiringPi PROPERTIES COMPILE_FLAGS ${wiringPi_CFLAGS}) ++set_target_properties(wiringPi PROPERTIES SOVERSION ${wiringPi_SOVERSION}) ++ ++install(TARGETS wiringPi ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${wiringPi_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +-- +1.8.1.5 + diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk new file mode 100644 index 0000000..4341f49 --- /dev/null +++ b/package/wiringpi/wiringpi.mk @@ -0,0 +1,14 @@ +############################################################# +# +# wiringpi +# +############################################################# + +WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6 +WIRINGPI_SITE = git://git.drogon.net/wiringPi +WIRINGPI_LICENSE = LGPLv3+ +WIRINGPI_LICENSE_FILES = COPYING.LESSER +WIRINGPI_INSTALL_STAGING = YES +WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release + +$(eval $(cmake-package)) -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package @ 2013-07-10 7:12 Guillermo A. Amaral 2013-07-10 9:26 ` Thomas Petazzoni 0 siblings, 1 reply; 16+ messages in thread From: Guillermo A. Amaral @ 2013-07-10 7:12 UTC (permalink / raw) To: buildroot From: "Guillermo A. Amaral" <g@maral.me> Signed-off-by: Guillermo A. Amaral <g@maral.me> --- package/Config.in | 1 + package/wiringpi/Config.in | 8 ++ package/wiringpi/wiringpi-CLOEXEC-undefined.patch | 15 ++++ package/wiringpi/wiringpi-cmake-support.patch | 101 ++++++++++++++++++++++ package/wiringpi/wiringpi.mk | 41 +++++++++ 5 files changed, 166 insertions(+) create mode 100644 package/wiringpi/Config.in create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch create mode 100644 package/wiringpi/wiringpi-cmake-support.patch create mode 100644 package/wiringpi/wiringpi.mk diff --git a/package/Config.in b/package/Config.in index 3186bb7..2824904 100644 --- a/package/Config.in +++ b/package/Config.in @@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in" source "package/usbmount/Config.in" source "package/usbutils/Config.in" source "package/wipe/Config.in" +source "package/wiringpi/Config.in" source "package/w_scan/Config.in" endmenu diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in new file mode 100644 index 0000000..7ce1048 --- /dev/null +++ b/package/wiringpi/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_WIRINGPI + bool "wiringpi" + depends on BR2_arm + help + GPIO Interface library for the Raspberry Pi. + + http://wiringpi.com/ + diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file mode 100644 index 0000000..097cb93 --- /dev/null +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch @@ -0,0 +1,15 @@ +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c +index ba61d9f..2ee23b9 100644 +--- a/wiringPi/wiringPi.c ++++ b/wiringPi/wiringPi.c +@@ -77,6 +77,10 @@ + #define FALSE (1==2) + #endif + ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ + // Environment Variables + + #define ENV_DEBUG "WIRINGPI_DEBUG" diff --git a/package/wiringpi/wiringpi-cmake-support.patch b/package/wiringpi/wiringpi-cmake-support.patch new file mode 100644 index 0000000..f6664ab --- /dev/null +++ b/package/wiringpi/wiringpi-cmake-support.patch @@ -0,0 +1,101 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..324ccff +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,9 @@ ++cmake_minimum_required(VERSION 2.8) ++ ++project(wiringPi) ++ ++set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared objects") ++ ++add_subdirectory(wiringPi) ++add_subdirectory(devLib) ++add_subdirectory(gpio) +diff --git a/devLib/CMakeLists.txt b/devLib/CMakeLists.txt +new file mode 100644 +index 0000000..6a7199d +--- /dev/null ++++ b/devLib/CMakeLists.txt +@@ -0,0 +1,27 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(devLib_SOVERSION "2.0") ++set(devLib_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB devLib_SRCS *.c) ++file(GLOB devLib_HDRS *.h) ++list(REMOVE_ITEM devLib_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/piFaceOld.c) ++ ++find_library(PTHREAD_LIBRARY pthread) ++ ++include_directories("../wiringPi") ++ ++add_library(wiringPiDev ${devLib_SRCS}) ++target_link_libraries(wiringPiDev ${PTHREAD_LIBRARY}) ++set_target_properties(wiringPiDev PROPERTIES COMPILE_FLAGS ${devLib_CFLAGS}) ++set_target_properties(wiringPiDev PROPERTIES SOVERSION ${devLib_SOVERSION}) ++ ++install(TARGETS wiringPiDev ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${devLib_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ +diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt +new file mode 100644 +index 0000000..a39e511 +--- /dev/null ++++ b/gpio/CMakeLists.txt +@@ -0,0 +1,20 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(gpio_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB gpio_SRCS *.c) ++ ++include_directories("../wiringPi") ++include_directories("../devLib") ++ ++find_library(M_LIBRARY m) ++find_library(PTHREAD_LIBRARY pthread) ++ ++add_executable(gpio ${gpio_SRCS}) ++target_link_libraries(gpio ${M_LIBRARY} ${PTHREAD_LIBRARY} wiringPi wiringPiDev) ++set_target_properties(gpio PROPERTIES COMPILE_FLAGS ${gpio_CFLAGS}) ++ ++install(TARGETS gpio ++ RUNTIME DESTINATION bin COMPONENT target ++) ++ +diff --git a/wiringPi/CMakeLists.txt b/wiringPi/CMakeLists.txt +new file mode 100644 +index 0000000..e54eaf6 +--- /dev/null ++++ b/wiringPi/CMakeLists.txt +@@ -0,0 +1,21 @@ ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++set(wiringPi_SOVERSION "2.0") ++set(wiringPi_CFLAGS "-Wformat=2 -Winline") ++ ++file(GLOB wiringPi_SRCS *.c) ++file(GLOB wiringPi_HDRS *.h) ++ ++add_library(wiringPi ${wiringPi_SRCS}) ++set_target_properties(wiringPi PROPERTIES COMPILE_FLAGS ${wiringPi_CFLAGS}) ++set_target_properties(wiringPi PROPERTIES SOVERSION ${wiringPi_SOVERSION}) ++ ++install(TARGETS wiringPi ++ LIBRARY DESTINATION lib COMPONENT target ++ ARCHIVE DESTINATION lib COMPONENT staging ++) ++ ++install(FILES ${wiringPi_HDRS} ++ DESTINATION include/wiringPi COMPONENT staging ++) ++ diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk new file mode 100644 index 0000000..2f38c4e --- /dev/null +++ b/package/wiringpi/wiringpi.mk @@ -0,0 +1,41 @@ +############################################################# +# +# wiringpi +# +############################################################# + +WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6 +WIRINGPI_SITE = git://git.drogon.net/wiringPi +WIRINGPI_LICENSE = LGPLv3+ +WIRINGPI_LICENSE_FILES = COPYING.LESSER +WIRINGPI_INSTALL_STAGING = YES +WIRINGPI_INSTALL_TARGET = YES +WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr + +define WIRINGPI_INSTALL_TARGET_CMDS + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(TARGET_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake" + mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_target.txt +endef + +define WIRINGPI_INSTALL_STAGING_CMDS + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=staging -P "$(@D)/cmake_install.cmake" + mv $(@D)/install_manifest_staging.txt $(@D)/install_manifest_staging_staging.txt + + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake" + mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_staging.txt +endef + +define WIRINGPI_POST_STAGING_CLEANUP + rm $(STAGING_DIR)/usr/bin/cpio +endef + +define WIRINGPI_UNINSTALL_TARGET_CMDS + xargs rm -f < $(@D)/install_manifest_target_target.txt +endef + +define WIRINGPI_UNINSTALL_STAGING_CMDS + xargs rm -f < $(@D)/install_manifest_staging_staging.txt + xargs rm -f < $(@D)/install_manifest_target_staging.txt +endef + +$(eval $(cmake-package)) -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package 2013-07-10 7:12 Guillermo A. Amaral @ 2013-07-10 9:26 ` Thomas Petazzoni 0 siblings, 0 replies; 16+ messages in thread From: Thomas Petazzoni @ 2013-07-10 9:26 UTC (permalink / raw) To: buildroot Dear Guillermo A. Amaral, On Wed, 10 Jul 2013 00:12:45 -0700, Guillermo A. Amaral wrote: > From: "Guillermo A. Amaral" <g@maral.me> > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > --- > package/Config.in | 1 + > package/wiringpi/Config.in | 8 ++ > package/wiringpi/wiringpi-CLOEXEC-undefined.patch | 15 ++++ > package/wiringpi/wiringpi-cmake-support.patch | 101 ++++++++++++++++++++++ > package/wiringpi/wiringpi.mk | 41 +++++++++ > 5 files changed, 166 insertions(+) > create mode 100644 package/wiringpi/Config.in > create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch > create mode 100644 package/wiringpi/wiringpi-cmake-support.patch > create mode 100644 package/wiringpi/wiringpi.mk Thanks for this patch! I'm giving a few comments below. On a side note, I'm really wondering why such hardware platform specific libraries are needed. Why aren't people using the standard Linux GPIO API in /sys/class/gpio, which is re-usable across hardware platforms? Why is it always that the RasberryPi community constantly invents for everything a non-standard way of doing things? Of course, that's nothing against your patch, but I'm really wondering what RasberryPi users are smoking. The big interest of Linux compared to micro-controller development is IMO that user-space interfaces are standardized across hardware platforms, so you can easily move on program from on platform to another, and re-use your knowledge between platforms. Those RasberryPi specific libraries really look like things being done by people who come from a micro-controller background, and don't understand the value of standardized APIs across hardware platforms. Anyway, enough rant. > diff --git a/package/Config.in b/package/Config.in > index 3186bb7..2824904 100644 > --- a/package/Config.in > +++ b/package/Config.in > @@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in" > source "package/usbmount/Config.in" > source "package/usbutils/Config.in" > source "package/wipe/Config.in" > +source "package/wiringpi/Config.in" > source "package/w_scan/Config.in" > endmenu > > diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in > new file mode 100644 > index 0000000..7ce1048 > --- /dev/null > +++ b/package/wiringpi/Config.in > @@ -0,0 +1,8 @@ > +config BR2_PACKAGE_WIRINGPI > + bool "wiringpi" Indentation should be a tab. > + depends on BR2_arm > + help > + GPIO Interface library for the Raspberry Pi. > + > + http://wiringpi.com/ > + > diff --git a/package/wiringpi/wiringpi-CLOEXEC-undefined.patch b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch > new file mode 100644 > index 0000000..097cb93 > --- /dev/null > +++ b/package/wiringpi/wiringpi-CLOEXEC-undefined.patch All patches should have a header with a description + Signed-off-by. > @@ -0,0 +1,15 @@ > +diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c > +index ba61d9f..2ee23b9 100644 > +--- a/wiringPi/wiringPi.c > ++++ b/wiringPi/wiringPi.c > +@@ -77,6 +77,10 @@ > + #define FALSE (1==2) > + #endif > + > ++#ifndef O_CLOEXEC > ++#define O_CLOEXEC 0 > ++#endif > ++ > + // Environment Variables > + > + #define ENV_DEBUG "WIRINGPI_DEBUG" > diff --git a/package/wiringpi/wiringpi-cmake-support.patch b/package/wiringpi/wiringpi-cmake-support.patch > new file mode 100644 > index 0000000..f6664ab > --- /dev/null > +++ b/package/wiringpi/wiringpi-cmake-support.patch Same thing here. However, can you comment on why you're adding a new build system here instead of using the Makefiles that come with the official version of this WiringPi thing? > diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk > new file mode 100644 > index 0000000..2f38c4e > --- /dev/null > +++ b/package/wiringpi/wiringpi.mk > @@ -0,0 +1,41 @@ > +############################################################# > +# > +# wiringpi > +# > +############################################################# > + > +WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6 > +WIRINGPI_SITE = git://git.drogon.net/wiringPi > +WIRINGPI_LICENSE = LGPLv3+ > +WIRINGPI_LICENSE_FILES = COPYING.LESSER > +WIRINGPI_INSTALL_STAGING = YES > +WIRINGPI_INSTALL_TARGET = YES This last line is not needed, that's the default. > +WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr CMAKE_INSTALL_PREFIX is already passed by the cmake-package infrastructure. Maybe CMAKE_BUILD_TYPE (which I believe is a standard CMake variable) should also be passed by the cmake package infrastructure. But OK, that's a separate contribution. > +define WIRINGPI_INSTALL_TARGET_CMDS > + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(TARGET_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake" > + mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_target.txt > +endef > + > +define WIRINGPI_INSTALL_STAGING_CMDS > + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=staging -P "$(@D)/cmake_install.cmake" > + mv $(@D)/install_manifest_staging.txt $(@D)/install_manifest_staging_staging.txt > + > + $(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake" > + mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_staging.txt > +endef Not sure what you're doing here. Why do you have those target and staging components? Just install everything to both staging and target. Headers, static libraries and such are automatically removed from the target/ directory by Buildroot. If there's anything else that is installed in target/ and isn't really needed, you can remove it from the target/ directory using a POST_INSTALL_TARGET hook. Your patch that introduces the CMake build system should not introduce within the WiringPi build system the notion of target vs. staging. > + > +define WIRINGPI_POST_STAGING_CLEANUP > + rm $(STAGING_DIR)/usr/bin/cpio > +endef This isn't used anywhere. > +define WIRINGPI_UNINSTALL_TARGET_CMDS > + xargs rm -f < $(@D)/install_manifest_target_target.txt > +endef > + > +define WIRINGPI_UNINSTALL_STAGING_CMDS > + xargs rm -f < $(@D)/install_manifest_staging_staging.txt > + xargs rm -f < $(@D)/install_manifest_target_staging.txt > +endef Don't bother implementing the uninstall steps, we're considering phasing them out. Thanks, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2013-07-12 6:54 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAPeEpDpMY2sRjGdd+TgPz5S--Pws+5hUNrV8jpiznxBqFZ7zDg@mail.gmail.com>
2013-07-11 5:17 ` [Buildroot] [PATCH] Raspberry Pi - WiringPi Library Package Guillermo A. Amaral
2013-07-11 5:19 ` Guillermo A. Amaral
2013-07-11 5:33 ` Baruch Siach
2013-07-11 6:00 ` Guillermo A. Amaral
2013-07-11 6:04 ` Baruch Siach
2013-07-11 6:38 ` Guillermo A. Amaral
2013-07-11 7:42 ` Carsten Schoenert
2013-07-11 17:55 ` Guillermo Amaral
2013-07-11 18:06 ` Baruch Siach
2013-07-11 18:22 ` Guillermo Amaral
2013-07-12 3:24 ` Baruch Siach
2013-07-12 4:30 ` Guillermo Amaral
2013-07-12 6:47 ` Baruch Siach
2013-07-12 6:54 ` Guillermo A. Amaral
2013-07-10 7:12 Guillermo A. Amaral
2013-07-10 9:26 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox