All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/1] package/simh: new package
@ 2016-08-17 12:34 Lothar Felten
  2016-08-17 20:07 ` Samuel Martin
  2016-08-17 20:21 ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Lothar Felten @ 2016-08-17 12:34 UTC (permalink / raw)
  To: buildroot

This package provides the simh multi-system emulator.
The simh makefile is replaced by a cmake project to handle cross compilation
correctly. Only a subset of the available simulators is built.

Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
---
 package/Config.in                                  |   1 +
 .../0001-add-cmake-build-for-cross-compile.patch   | 394 +++++++++++++++++++++
 package/simh/Config.in                             |  10 +
 package/simh/simh.hash                             |   2 +
 package/simh/simh.mk                               |  18 +
 5 files changed, 425 insertions(+)
 create mode 100644 package/simh/0001-add-cmake-build-for-cross-compile.patch
 create mode 100644 package/simh/Config.in
 create mode 100644 package/simh/simh.hash
 create mode 100644 package/simh/simh.mk

diff --git a/package/Config.in b/package/Config.in
index 645fa29..993b446 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -219,6 +219,7 @@ menu "Games"
 	source "package/opentyrian-data/Config.in"
 	source "package/prboom/Config.in"
 	source "package/rubix/Config.in"
+	source "package/simh/Config.in"
 	source "package/sl/Config.in"
 	source "package/stella/Config.in"
 	source "package/supertuxkart/Config.in"
diff --git a/package/simh/0001-add-cmake-build-for-cross-compile.patch b/package/simh/0001-add-cmake-build-for-cross-compile.patch
new file mode 100644
index 0000000..577d5e5
--- /dev/null
+++ b/package/simh/0001-add-cmake-build-for-cross-compile.patch
@@ -0,0 +1,394 @@
+From 29a841225a5e931e26a309f612333a4d98aca720 Mon Sep 17 00:00:00 2001
+From: Lothar Felten <lothar.felten@gmail.com>
+Date: Wed, 17 Aug 2016 11:18:37 +0200
+Subject: [PATCH] add cmake build for cross compile
+
+The default simh makefile has some issues when cross compiling for a different
+architecture. This patch adds CMakeLists.txt so the simh project can be built
+with cmake.
+Only a reduced set of simulators will be built.
+
+Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
+---
+ CMakeLists.txt | 369 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 369 insertions(+)
+ create mode 100644 CMakeLists.txt
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 0000000..d6bb0bb
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,369 @@
++#
++# CMakeLists for simh project
++#
++# The default simh makefile is not suited for cross compile
++# This cmake project for Linux supports only some of the simulators
++#
++# USAGE (out of source build):
++#	- make directory next to simh sources
++#	- cmake <path to simh/CMakeLists.txt>
++#	- run make
++#
++#	example:
++#		git clone https://github.com/simh/simh
++#		mkdir build
++#		cd build
++#		cmake ../simh/
++#		make
++#
++# TODO: 
++#	- add support for Windos/MacOS/...
++#	- build the simulator core as independent library (requires
++#	  code changes because the net/video option is handled at
++#	  compile time)
++#	- add BuildROMs routine
++#	- add all available simulators
++#	- more testing
++#
++# 2016 Lothar Felten <lothar.felten@gmail.com>
++#
++cmake_minimum_required (VERSION 2.8)
++project (simh)
++
++#
++# OPTIONS
++#
++option(BUILD_IBM1130  "build ibm1130 simulator" ON)
++option(BUILD_NOVA     "build nova    simulator" ON)
++option(BUILD_PDP1     "build pdp1    simulator" ON)
++option(BUILD_PDP4     "build pdp4    simulator" ON)
++option(BUILD_PDP7     "build pdp7    simulator" ON)
++option(BUILD_PDP8     "build pdp8    simulator" ON)
++option(BUILD_PDP9     "build pdp9    simulator" ON)
++option(BUILD_PDP10    "build pdp10   simulator" ON)
++option(BUILD_PDP11    "build pdp11   simulator" ON)
++option(BUILD_PDP15    "build pdp15   simulator" ON)
++option(VIDEO          "video option (requires libSDL2)" ON)
++option(NETWORK        "network option (requires libpcap, pthreads)" ON)
++
++#
++# DEBUG
++#
++#set(CMAKE_VERBOSE_MAKEFILE ON)
++
++#
++# EXTERNAL LIBRARIES
++#
++if(UNIX)
++	#add_definitions(-Wall) # very noisy
++	add_definitions(-Wp,-w) # suppress preprocessor warnings
++	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE")
++	find_library(MATH_LIBRARY m)
++endif(UNIX)
++
++#
++# NETWORK?
++#
++find_library(PCAP_LIBRARY pcap)
++find_library(PTHREAD_LIBRARY pthread)
++if(NETWORK AND PCAP_LIBRARY AND PTHREAD_LIBRARY)
++	set(NETWORK_FLAGS "-DUSE_NETWORK -DHAVE_PCAP_NETWORK")
++	message("network support available (libpcap & pthreads found)")
++	set(ADD_NETWORK)
++elseif(NOT (PCAP_LIBRARY AND PTHREAD_LIBRARY))
++	message("no network support (libpcap & pthreads required)")
++else()
++	message("no network support (disabled)")
++endif()
++
++#
++# VIDEO?
++#
++find_library(SDL2_LIBRARY SDL2)
++if(VIDEO AND SDL2_LIBRARY)
++	find_path(SDL2_INCLUDE_DIR NAMES SDL.h
++		HINTS ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS}
++		PATH_SUFFIXES SDL2)
++	set(VIDEO_FLAGS "-I${SDL2_INCLUDE_DIR} -DHAVE_LIBSDL -DUSE_SIM_VIDEO -DUSE_DISPLAY")
++	set(display_source_files
++		display/display.c
++		display/sim_ws.c
++	)
++	set(vt_source_files
++		display/vt11.c
++	)
++	set(ADD_VIDEO)
++	message("video support available (libSDL2 found)")
++elseif(NOT SDL2_LIBRARY)
++	message("no video support (libSDL2 required)")
++else()
++	message("no video support (disabled)")
++endif()
++
++#
++# SIMULATOR FILES
++#
++set(simulator_source_files
++	scp.c
++	sim_console.c
++	sim_fio.c
++	sim_timer.c
++	sim_sock.c
++	sim_tmxr.c
++	sim_ether.c
++	sim_tape.c
++	sim_disk.c
++	sim_serial.c
++	sim_imd.c
++	sim_card.c
++	sim_video.c
++)
++#
++# MACHINE FILES
++#
++set(ibm1130_source_files
++	Ibm1130/ibm1130_cpu.c
++	Ibm1130/ibm1130_cr.c
++	Ibm1130/ibm1130_disk.c
++	Ibm1130/ibm1130_fmt.c
++	Ibm1130/ibm1130_gdu.c
++	Ibm1130/ibm1130_gui.c
++	Ibm1130/ibm1130_plot.c
++	Ibm1130/ibm1130_prt.c
++	Ibm1130/ibm1130_ptrp.c
++	Ibm1130/ibm1130_sca.c
++	Ibm1130/ibm1130_stddev.c
++	Ibm1130/ibm1130_sys.c
++	Ibm1130/ibm1130_t2741.c
++)
++set(nova_source_files
++	NOVA/nova_clk.c
++	NOVA/nova_cpu.c
++	NOVA/nova_dkp.c
++	NOVA/nova_dsk.c
++	NOVA/nova_lp.c
++	NOVA/nova_mta.c
++	NOVA/nova_plt.c
++	NOVA/nova_pt.c
++	NOVA/nova_qty.c
++	NOVA/nova_sys.c
++	NOVA/nova_tt1.c
++	NOVA/nova_tt.c
++)
++set(pdp1_source_files
++	PDP1/pdp1_clk.c
++	PDP1/pdp1_cpu.c
++	PDP1/pdp1_dcs.c
++	PDP1/pdp1_defs.h
++	PDP1/pdp1_diag.txt
++	PDP1/pdp1_dpy.c
++	PDP1/pdp1_drm.c
++	PDP1/pdp1_dt.c
++	PDP1/pdp1_lp.c
++	PDP1/pdp1_stddev.c
++	PDP1/pdp1_sys.c
++)
++set(pdp8_source_files
++	PDP8/pdp8_clk.c
++	PDP8/pdp8_cpu.c
++	PDP8/pdp8_ct.c
++	PDP8/pdp8_df.c
++	PDP8/pdp8_dt.c
++	PDP8/pdp8_fpp.c
++	PDP8/pdp8_lp.c
++	PDP8/pdp8_mt.c
++	PDP8/pdp8_pt.c
++	PDP8/pdp8_rf.c
++	PDP8/pdp8_rk.c
++	PDP8/pdp8_rl.c
++	PDP8/pdp8_rx.c
++	PDP8/pdp8_sys.c
++	PDP8/pdp8_td.c
++	PDP8/pdp8_tsc.c
++	PDP8/pdp8_tt.c
++	PDP8/pdp8_ttx.c
++)
++set(pdp10_source_files
++	PDP10/pdp10_fe.c
++	PDP10/pdp10_cpu.c
++	PDP10/pdp10_ksio.c
++	PDP10/pdp10_lp20.c
++	PDP10/pdp10_mdfp.c
++	PDP10/pdp10_pag.c
++	PDP10/pdp10_rp.c
++	PDP10/pdp10_sys.c
++	PDP10/pdp10_tim.c
++	PDP10/pdp10_tu.c
++	PDP10/pdp10_xtnd.c
++	PDP11/pdp11_pt.c
++	PDP11/pdp11_ry.c
++	PDP11/pdp11_cr.c
++	PDP11/pdp11_dup.c
++	PDP11/pdp11_dmc.c
++	PDP11/pdp11_kmc.c
++	PDP11/pdp11_xu.c
++	PDP11/pdp11_dz.c
++)
++set(pdp11_source_files
++	PDP11/pdp11_cis.c
++	PDP11/pdp11_cpu.c
++	PDP11/pdp11_cpumod.c
++	PDP11/pdp11_cr.c
++	PDP11/pdp11_dc.c
++	PDP11/pdp11_dl.c
++	PDP11/pdp11_dmc.c
++	PDP11/pdp11_dup.c
++	PDP11/pdp11_dz.c
++	PDP11/pdp11_fp.c
++	PDP11/pdp11_hk.c
++	PDP11/pdp11_io.c
++	PDP11/pdp11_io_lib.c
++	PDP11/pdp11_ke.c
++	PDP11/pdp11_kg.c
++	PDP11/pdp11_kmc.c
++	PDP11/pdp11_lp.c
++	PDP11/pdp11_pclk.c
++	PDP11/pdp11_pt.c
++	PDP11/pdp11_rc.c
++	PDP11/pdp11_rf.c
++	PDP11/pdp11_rh.c
++	PDP11/pdp11_rk.c
++	PDP11/pdp11_rl.c
++	PDP11/pdp11_rp.c
++	PDP11/pdp11_rq.c
++	PDP11/pdp11_rs.c
++	PDP11/pdp11_rx.c
++	PDP11/pdp11_ry.c
++	PDP11/pdp11_stddev.c
++	PDP11/pdp11_sys.c
++	PDP11/pdp11_ta.c
++	PDP11/pdp11_tc.c
++	PDP11/pdp11_td.c
++	PDP11/pdp11_tm.c
++	PDP11/pdp11_tq.c
++	PDP11/pdp11_ts.c
++	PDP11/pdp11_tu.c
++	PDP11/pdp11_vh.c
++	PDP11/pdp11_vt.c
++	PDP11/pdp11_xq.c
++	PDP11/pdp11_xu.c
++)
++set(pdp18b_source_files
++	PDP18B/pdp18b_cpu.c
++	PDP18B/pdp18b_drm.c
++	PDP18B/pdp18b_dt.c
++	PDP18B/pdp18b_fpp.c
++	PDP18B/pdp18b_g2tty.c
++	PDP18B/pdp18b_lp.c
++	PDP18B/pdp18b_mt.c
++	PDP18B/pdp18b_rb.c
++	PDP18B/pdp18b_rf.c
++	PDP18B/pdp18b_rp.c
++	PDP18B/pdp18b_stddev.c
++	PDP18B/pdp18b_sys.c
++	PDP18B/pdp18b_tt1.c
++)
++
++#
++# BUILD TARGETS
++#
++if(BUILD_IBM1130)
++	include_directories(.)
++	add_executable(ibm1130 ${ibm1130_source_files} ${simulator_source_files})
++	#set_target_properties(ibm1130 PROPERTIES COMPILE_FLAGS " -DGUI_SUPPORT -lgdi32")#TODO
++	target_link_libraries(ibm1130 m)
++	install (TARGETS ibm1130 DESTINATION bin)
++endif(BUILD_IBM1130)
++
++if(BUILD_NOVA)
++	include_directories(.)
++	add_executable(nova ${nova_source_files} ${simulator_source_files})
++	target_link_libraries(nova m)
++	install (TARGETS nova DESTINATION bin)
++endif(BUILD_NOVA)
++
++if(BUILD_PDP1)
++	include_directories(.)
++	add_executable(pdp1 ${pdp1_source_files} ${simulator_source_files} ${display_source_files})
++	if(ADD_VIDEO)
++		set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DDISPLAY_TYPE=DIS_TYPE30")
++		set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DPIX_SCALE=RES_HALF")
++		set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")
++		target_link_libraries(pdp1 SDL2)
++	endif(ADD_VIDEO)
++	target_link_libraries(pdp1 m)
++	install (TARGETS pdp1 DESTINATION bin)
++endif(BUILD_PDP1)
++
++if(BUILD_PDP4)
++	include_directories(.)
++	add_executable(pdp4 ${pdp18b_source_files} ${simulator_source_files})
++	set_target_properties(pdp4 PROPERTIES COMPILE_FLAGS "-DPDP4")
++	target_link_libraries(pdp4 m)
++	install (TARGETS pdp4 DESTINATION bin)
++endif(BUILD_PDP4)
++
++if(BUILD_PDP7)
++	include_directories(.)
++	add_executable(pdp7 ${pdp18b_source_files} ${simulator_source_files})
++	set_target_properties(pdp7 PROPERTIES COMPILE_FLAGS "-DPDP7")
++	target_link_libraries(pdp7 m)
++	install (TARGETS pdp7 DESTINATION bin)
++endif(BUILD_PDP7)
++
++if(BUILD_PDP8)
++	include_directories(.)
++	add_executable(pdp8 ${pdp8_source_files} ${simulator_source_files})
++	target_link_libraries(pdp8 m)
++	install (TARGETS pdp8 DESTINATION bin)
++endif(BUILD_PDP8)
++
++if(BUILD_PDP9)
++	include_directories(.)
++	add_executable(pdp9 ${pdp18b_source_files} ${simulator_source_files})
++	set_target_properties(pdp9 PROPERTIES COMPILE_FLAGS "-DPDP9")
++	target_link_libraries(pdp9 m)
++	install (TARGETS pdp9 DESTINATION bin)
++endif(BUILD_PDP9)
++
++if(BUILD_PDP10)
++	include_directories(.)
++	include_directories(PDP10)
++	add_executable(pdp10 ${pdp10_source_files} ${simulator_source_files})
++	set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DVM_PDP10 -DUSE_INT64")
++	target_link_libraries(pdp10 m)
++	if(ADD_NETWORK)
++		message("PDP10 NETWORK!!!!")
++		set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")
++		target_link_libraries(pdp10 pcap)
++		target_link_libraries(pdp10 pthread)
++	endif(ADD_NETWORK)
++	install (TARGETS pdp10 DESTINATION bin)
++endif(BUILD_PDP10)
++
++if(BUILD_PDP11)
++	include_directories(.)
++	add_executable(pdp11 ${pdp11_source_files} ${simulator_source_files} ${display_source_files}
++		${vt_source_files})
++	set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DVM_PDP11")
++	target_link_libraries(pdp11 m)
++	if(ADD_NETWORK)
++		set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")
++		target_link_libraries(pdp11 pcap)
++		target_link_libraries(pdp11 pthread)
++	endif(ADD_NETWORK)
++	if(ADD_VIDEO)
++		set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")
++		target_link_libraries(pdp11 SDL2)
++	endif(ADD_VIDEO)
++	install (TARGETS pdp11 DESTINATION bin)
++endif(BUILD_PDP11)
++
++if(BUILD_PDP15)
++	include_directories(.)
++	add_executable(pdp15 ${pdp18b_source_files} ${simulator_source_files})
++	set_target_properties(pdp15 PROPERTIES COMPILE_FLAGS "-DPDP15")
++	target_link_libraries(pdp15 m)
++	install (TARGETS pdp15 DESTINATION bin)
++endif(BUILD_PDP15)
++
+-- 
+1.9.1
+
diff --git a/package/simh/Config.in b/package/simh/Config.in
new file mode 100644
index 0000000..e38044a
--- /dev/null
+++ b/package/simh/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_SIMH
+	bool "simh"
+	depends on BR2_USE_MMU # fork()
+	help
+	  SIMH is a highly portable, multi-system simulator.
+	  Optional network support requires libpcap and pthreads, video
+	  support requires libSDL2.
+	  Only a subset of the available simulators is built.
+
+	  http://simh.trailing-edge.com
diff --git a/package/simh/simh.hash b/package/simh/simh.hash
new file mode 100644
index 0000000..cb6aeac
--- /dev/null
+++ b/package/simh/simh.hash
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz
diff --git a/package/simh/simh.mk b/package/simh/simh.mk
new file mode 100644
index 0000000..1b576f7
--- /dev/null
+++ b/package/simh/simh.mk
@@ -0,0 +1,18 @@
+################################################################################
+#
+# simh
+#
+################################################################################
+
+SIMH_VERSION = 946bfd329f9f6624364b266dc66005151c3fc018
+SIMH_SITE = $(call github,simh,simh,$(SIMH_VERSION))
+SIMH_LICENSE = MIT, GPLv2, zlib license
+SIMH_LICENSE_FILES = doc/simh.doc Intel-Systems/common/i8088.c sim_video.c
+
+define SIMH_MOVE_MAKEFILE
+	mv $(@D)/makefile $(@D)/_simh_makefile
+endef
+
+SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE
+
+$(eval $(cmake-package))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/simh: new package
  2016-08-17 12:34 [Buildroot] [PATCH v3 1/1] package/simh: new package Lothar Felten
@ 2016-08-17 20:07 ` Samuel Martin
  2016-08-18 21:45   ` Lothar Felten
  2016-08-17 20:21 ` Thomas Petazzoni
  1 sibling, 1 reply; 5+ messages in thread
From: Samuel Martin @ 2016-08-17 20:07 UTC (permalink / raw)
  To: buildroot

Hi,

On Aug 17, 2016 2:35 PM, "Lothar Felten" <lothar.felten@gmail.com> wrote:
>
> This package provides the simh multi-system emulator.
> The simh makefile is replaced by a cmake project to handle cross
compilation
> correctly. Only a subset of the available simulators is built.
>
> Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
> ---
>  package/Config.in                                  |   1 +
>  .../0001-add-cmake-build-for-cross-compile.patch   | 394
+++++++++++++++++++++
>  package/simh/Config.in                             |  10 +
>  package/simh/simh.hash                             |   2 +
>  package/simh/simh.mk                               |  18 +
>  5 files changed, 425 insertions(+)
>  create mode 100644 package/simh/0001-add-cmake-
build-for-cross-compile.patch
>  create mode 100644 package/simh/Config.in
>  create mode 100644 package/simh/simh.hash
>  create mode 100644 package/simh/simh.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 645fa29..993b446 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -219,6 +219,7 @@ menu "Games"
>         source "package/opentyrian-data/Config.in"
>         source "package/prboom/Config.in"
>         source "package/rubix/Config.in"
> +       source "package/simh/Config.in"
>         source "package/sl/Config.in"
>         source "package/stella/Config.in"
>         source "package/supertuxkart/Config.in"
> diff --git a/package/simh/0001-add-cmake-build-for-cross-compile.patch
b/package/simh/0001-add-cmake-build-for-cross-compile.patch
> new file mode 100644
> index 0000000..577d5e5
> --- /dev/null
> +++ b/package/simh/0001-add-cmake-build-for-cross-compile.patch
> @@ -0,0 +1,394 @@
> +From 29a841225a5e931e26a309f612333a4d98aca720 Mon Sep 17 00:00:00 2001
> +From: Lothar Felten <lothar.felten@gmail.com>
> +Date: Wed, 17 Aug 2016 11:18:37 +0200
> +Subject: [PATCH] add cmake build for cross compile
> +
> +The default simh makefile has some issues when cross compiling for a
different
> +architecture. This patch adds CMakeLists.txt so the simh project can be
built
> +with cmake.
> +Only a reduced set of simulators will be built.
> +
> +Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
> +---
> + CMakeLists.txt | 369 ++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++
> + 1 file changed, 369 insertions(+)
> + create mode 100644 CMakeLists.txt
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +new file mode 100644
> +index 0000000..d6bb0bb
> +--- /dev/null
> ++++ b/CMakeLists.txt
> +@@ -0,0 +1,369 @@
> ++#
> ++# CMakeLists for simh project
> ++#
> ++# The default simh makefile is not suited for cross compile
> ++# This cmake project for Linux supports only some of the simulators
> ++#
> ++# USAGE (out of source build):
> ++#     - make directory next to simh sources
> ++#     - cmake <path to simh/CMakeLists.txt>
> ++#     - run make
> ++#
> ++#     example:
> ++#             git clone https://github.com/simh/simh
> ++#             mkdir build
> ++#             cd build
> ++#             cmake ../simh/
> ++#             make
> ++#
> ++# TODO:
> ++#     - add support for Windos/MacOS/...
> ++#     - build the simulator core as independent library (requires
> ++#       code changes because the net/video option is handled at
> ++#       compile time)
> ++#     - add BuildROMs routine
> ++#     - add all available simulators
> ++#     - more testing
> ++#
> ++# 2016 Lothar Felten <lothar.felten@gmail.com>
> ++#
> ++cmake_minimum_required (VERSION 2.8)
> ++project (simh)
> ++
> ++#
> ++# OPTIONS
> ++#
> ++option(BUILD_IBM1130  "build ibm1130 simulator" ON)
> ++option(BUILD_NOVA     "build nova    simulator" ON)
> ++option(BUILD_PDP1     "build pdp1    simulator" ON)
> ++option(BUILD_PDP4     "build pdp4    simulator" ON)
> ++option(BUILD_PDP7     "build pdp7    simulator" ON)
> ++option(BUILD_PDP8     "build pdp8    simulator" ON)
> ++option(BUILD_PDP9     "build pdp9    simulator" ON)
> ++option(BUILD_PDP10    "build pdp10   simulator" ON)
> ++option(BUILD_PDP11    "build pdp11   simulator" ON)
> ++option(BUILD_PDP15    "build pdp15   simulator" ON)
> ++option(VIDEO          "video option (requires libSDL2)" ON)
> ++option(NETWORK        "network option (requires libpcap, pthreads)" ON)
> ++
> ++#
> ++# DEBUG
> ++#
> ++#set(CMAKE_VERBOSE_MAKEFILE ON)
> ++
> ++#
> ++# EXTERNAL LIBRARIES
> ++#
> ++if(UNIX)
> ++      #add_definitions(-Wall) # very noisy
> ++      add_definitions(-Wp,-w) # suppress preprocessor warnings
> ++      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE")

Buildroot automatically and always adds -D_LARGEFILE64_SOURCE flag.
For a long-run patch, I would prefer the largefile check on the toolchain.

> ++      find_library(MATH_LIBRARY m)

Where is MATH_LIBRARY used?
Is math lib. required? If so, add the required option to the find_package
(see [1]).

> ++endif(UNIX)
> ++
> ++#
> ++# NETWORK?
> ++#
> ++find_library(PCAP_LIBRARY pcap)

You may want to add the quiet option to find_package [1].

> ++find_library(PTHREAD_LIBRARY pthread)

Ditto

> ++if(NETWORK AND PCAP_LIBRARY AND PTHREAD_LIBRARY)
> ++      set(NETWORK_FLAGS "-DUSE_NETWORK -DHAVE_PCAP_NETWORK")
> ++      message("network support available (libpcap & pthreads found)")
> ++      set(ADD_NETWORK)
> ++elseif(NOT (PCAP_LIBRARY AND PTHREAD_LIBRARY))
> ++      message("no network support (libpcap & pthreads required)")
> ++else()
> ++      message("no network support (disabled)")
> ++endif()
> ++
> ++#
> ++# VIDEO?
> ++#
> ++find_library(SDL2_LIBRARY SDL2)

Ditto

> ++if(VIDEO AND SDL2_LIBRARY)
> ++      find_path(SDL2_INCLUDE_DIR NAMES SDL.h
> ++              HINTS ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS}

Where do these PC_SDL2_* cars come from?
I guess you miss the following lines:

<snip>
find_package(pkgconfig quiet)
if(PKGCONFIG_FOUND)
  pkg_check_modules(PC_SDL2_ sdl2) # see [2]
endif()
</snip>

> ++              PATH_SUFFIXES SDL2)
> ++      set(VIDEO_FLAGS "-I${SDL2_INCLUDE_DIR} -DHAVE_LIBSDL
-DUSE_SIM_VIDEO -DUSE_DISPLAY")
> ++      set(display_source_files
> ++              display/display.c
> ++              display/sim_ws.c
> ++      )
> ++      set(vt_source_files
> ++              display/vt11.c
> ++      )
> ++      set(ADD_VIDEO)
> ++      message("video support available (libSDL2 found)")
> ++elseif(NOT SDL2_LIBRARY)
> ++      message("no video support (libSDL2 required)")
> ++else()
> ++      message("no video support (disabled)")
> ++endif()
> ++
> ++#
> ++# SIMULATOR FILES
> ++#
> ++set(simulator_source_files
> ++      scp.c
> ++      sim_console.c
> ++      sim_fio.c
> ++      sim_timer.c
> ++      sim_sock.c
> ++      sim_tmxr.c
> ++      sim_ether.c
> ++      sim_tape.c
> ++      sim_disk.c
> ++      sim_serial.c
> ++      sim_imd.c
> ++      sim_card.c
> ++      sim_video.c
> ++)
> ++#
> ++# MACHINE FILES
> ++#
> ++set(ibm1130_source_files
> ++      Ibm1130/ibm1130_cpu.c
> ++      Ibm1130/ibm1130_cr.c
> ++      Ibm1130/ibm1130_disk.c
> ++      Ibm1130/ibm1130_fmt.c
> ++      Ibm1130/ibm1130_gdu.c
> ++      Ibm1130/ibm1130_gui.c
> ++      Ibm1130/ibm1130_plot.c
> ++      Ibm1130/ibm1130_prt.c
> ++      Ibm1130/ibm1130_ptrp.c
> ++      Ibm1130/ibm1130_sca.c
> ++      Ibm1130/ibm1130_stddev.c
> ++      Ibm1130/ibm1130_sys.c
> ++      Ibm1130/ibm1130_t2741.c
> ++)
> ++set(nova_source_files
> ++      NOVA/nova_clk.c
> ++      NOVA/nova_cpu.c
> ++      NOVA/nova_dkp.c
> ++      NOVA/nova_dsk.c
> ++      NOVA/nova_lp.c
> ++      NOVA/nova_mta.c
> ++      NOVA/nova_plt.c
> ++      NOVA/nova_pt.c
> ++      NOVA/nova_qty.c
> ++      NOVA/nova_sys.c
> ++      NOVA/nova_tt1.c
> ++      NOVA/nova_tt.c
> ++)
> ++set(pdp1_source_files
> ++      PDP1/pdp1_clk.c
> ++      PDP1/pdp1_cpu.c
> ++      PDP1/pdp1_dcs.c
> ++      PDP1/pdp1_defs.h
> ++      PDP1/pdp1_diag.txt
> ++      PDP1/pdp1_dpy.c
> ++      PDP1/pdp1_drm.c
> ++      PDP1/pdp1_dt.c
> ++      PDP1/pdp1_lp.c
> ++      PDP1/pdp1_stddev.c
> ++      PDP1/pdp1_sys.c
> ++)
> ++set(pdp8_source_files
> ++      PDP8/pdp8_clk.c
> ++      PDP8/pdp8_cpu.c
> ++      PDP8/pdp8_ct.c
> ++      PDP8/pdp8_df.c
> ++      PDP8/pdp8_dt.c
> ++      PDP8/pdp8_fpp.c
> ++      PDP8/pdp8_lp.c
> ++      PDP8/pdp8_mt.c
> ++      PDP8/pdp8_pt.c
> ++      PDP8/pdp8_rf.c
> ++      PDP8/pdp8_rk.c
> ++      PDP8/pdp8_rl.c
> ++      PDP8/pdp8_rx.c
> ++      PDP8/pdp8_sys.c
> ++      PDP8/pdp8_td.c
> ++      PDP8/pdp8_tsc.c
> ++      PDP8/pdp8_tt.c
> ++      PDP8/pdp8_ttx.c
> ++)
> ++set(pdp10_source_files
> ++      PDP10/pdp10_fe.c
> ++      PDP10/pdp10_cpu.c
> ++      PDP10/pdp10_ksio.c
> ++      PDP10/pdp10_lp20.c
> ++      PDP10/pdp10_mdfp.c
> ++      PDP10/pdp10_pag.c
> ++      PDP10/pdp10_rp.c
> ++      PDP10/pdp10_sys.c
> ++      PDP10/pdp10_tim.c
> ++      PDP10/pdp10_tu.c
> ++      PDP10/pdp10_xtnd.c
> ++      PDP11/pdp11_pt.c
> ++      PDP11/pdp11_ry.c
> ++      PDP11/pdp11_cr.c
> ++      PDP11/pdp11_dup.c
> ++      PDP11/pdp11_dmc.c
> ++      PDP11/pdp11_kmc.c
> ++      PDP11/pdp11_xu.c
> ++      PDP11/pdp11_dz.c
> ++)
> ++set(pdp11_source_files
> ++      PDP11/pdp11_cis.c
> ++      PDP11/pdp11_cpu.c
> ++      PDP11/pdp11_cpumod.c
> ++      PDP11/pdp11_cr.c
> ++      PDP11/pdp11_dc.c
> ++      PDP11/pdp11_dl.c
> ++      PDP11/pdp11_dmc.c
> ++      PDP11/pdp11_dup.c
> ++      PDP11/pdp11_dz.c
> ++      PDP11/pdp11_fp.c
> ++      PDP11/pdp11_hk.c
> ++      PDP11/pdp11_io.c
> ++      PDP11/pdp11_io_lib.c
> ++      PDP11/pdp11_ke.c
> ++      PDP11/pdp11_kg.c
> ++      PDP11/pdp11_kmc.c
> ++      PDP11/pdp11_lp.c
> ++      PDP11/pdp11_pclk.c
> ++      PDP11/pdp11_pt.c
> ++      PDP11/pdp11_rc.c
> ++      PDP11/pdp11_rf.c
> ++      PDP11/pdp11_rh.c
> ++      PDP11/pdp11_rk.c
> ++      PDP11/pdp11_rl.c
> ++      PDP11/pdp11_rp.c
> ++      PDP11/pdp11_rq.c
> ++      PDP11/pdp11_rs.c
> ++      PDP11/pdp11_rx.c
> ++      PDP11/pdp11_ry.c
> ++      PDP11/pdp11_stddev.c
> ++      PDP11/pdp11_sys.c
> ++      PDP11/pdp11_ta.c
> ++      PDP11/pdp11_tc.c
> ++      PDP11/pdp11_td.c
> ++      PDP11/pdp11_tm.c
> ++      PDP11/pdp11_tq.c
> ++      PDP11/pdp11_ts.c
> ++      PDP11/pdp11_tu.c
> ++      PDP11/pdp11_vh.c
> ++      PDP11/pdp11_vt.c
> ++      PDP11/pdp11_xq.c
> ++      PDP11/pdp11_xu.c
> ++)
> ++set(pdp18b_source_files
> ++      PDP18B/pdp18b_cpu.c
> ++      PDP18B/pdp18b_drm.c
> ++      PDP18B/pdp18b_dt.c
> ++      PDP18B/pdp18b_fpp.c
> ++      PDP18B/pdp18b_g2tty.c
> ++      PDP18B/pdp18b_lp.c
> ++      PDP18B/pdp18b_mt.c
> ++      PDP18B/pdp18b_rb.c
> ++      PDP18B/pdp18b_rf.c
> ++      PDP18B/pdp18b_rp.c
> ++      PDP18B/pdp18b_stddev.c
> ++      PDP18B/pdp18b_sys.c
> ++      PDP18B/pdp18b_tt1.c
> ++)
> ++
> ++#
> ++# BUILD TARGETS
> ++#
> ++if(BUILD_IBM1130)
> ++      include_directories(.)
> ++      add_executable(ibm1130 ${ibm1130_source_files}
${simulator_source_files})
> ++      #set_target_properties(ibm1130 PROPERTIES COMPILE_FLAGS "
-DGUI_SUPPORT -lgdi32")#TODO
> ++      target_link_libraries(ibm1130 m)

s/\<m\>/${MATH_LIBRARY}/
This target_link_library should be nested in a if(UNIX)-block.

> ++      install (TARGETS ibm1130 DESTINATION bin)
> ++endif(BUILD_IBM1130)
> ++
> ++if(BUILD_NOVA)
> ++      include_directories(.)
> ++      add_executable(nova ${nova_source_files}
${simulator_source_files})
> ++      target_link_libraries(nova m)

ditto

> ++      install (TARGETS nova DESTINATION bin)
> ++endif(BUILD_NOVA)
> ++
> ++if(BUILD_PDP1)
> ++      include_directories(.)
> ++      add_executable(pdp1 ${pdp1_source_files}
${simulator_source_files} ${display_source_files})
> ++      if(ADD_VIDEO)
> ++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} -DDISPLAY_TYPE=DIS_TYPE30")
> ++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} -DPIX_SCALE=RES_HALF")
> ++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")
> ++              target_link_libraries(pdp1 SDL2)
> ++      endif(ADD_VIDEO)
> ++      target_link_libraries(pdp1 m)

ditto

> ++      install (TARGETS pdp1 DESTINATION bin)
> ++endif(BUILD_PDP1)
> ++
> ++if(BUILD_PDP4)
> ++      include_directories(.)
> ++      add_executable(pdp4 ${pdp18b_source_files}
${simulator_source_files})
> ++      set_target_properties(pdp4 PROPERTIES COMPILE_FLAGS "-DPDP4")
> ++      target_link_libraries(pdp4 m)

ditto

> ++      install (TARGETS pdp4 DESTINATION bin)
> ++endif(BUILD_PDP4)
> ++
> ++if(BUILD_PDP7)
> ++      include_directories(.)
> ++      add_executable(pdp7 ${pdp18b_source_files}
${simulator_source_files})
> ++      set_target_properties(pdp7 PROPERTIES COMPILE_FLAGS "-DPDP7")
> ++      target_link_libraries(pdp7 m)

ditto

> ++      install (TARGETS pdp7 DESTINATION bin)
> ++endif(BUILD_PDP7)
> ++
> ++if(BUILD_PDP8)
> ++      include_directories(.)
> ++      add_executable(pdp8 ${pdp8_source_files}
${simulator_source_files})
> ++      target_link_libraries(pdp8 m)

ditto

> ++      install (TARGETS pdp8 DESTINATION bin)
> ++endif(BUILD_PDP8)
> ++
> ++if(BUILD_PDP9)
> ++      include_directories(.)
> ++      add_executable(pdp9 ${pdp18b_source_files}
${simulator_source_files})
> ++      set_target_properties(pdp9 PROPERTIES COMPILE_FLAGS "-DPDP9")
> ++      target_link_libraries(pdp9 m)

ditto

> ++      install (TARGETS pdp9 DESTINATION bin)
> ++endif(BUILD_PDP9)
> ++
> ++if(BUILD_PDP10)
> ++      include_directories(.)
> ++      include_directories(PDP10)
> ++      add_executable(pdp10 ${pdp10_source_files}
${simulator_source_files})
> ++      set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} -DVM_PDP10 -DUSE_INT64")
> ++      target_link_libraries(pdp10 m)

ditto

> ++      if(ADD_NETWORK)
> ++              message("PDP10 NETWORK!!!!")
> ++              set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")
> ++              target_link_libraries(pdp10 pcap)

use the right cmake variable here ${PCAP_LIBRARY}

> ++              target_link_libraries(pdp10 pthread)

ditto

> ++      endif(ADD_NETWORK)
> ++      install (TARGETS pdp10 DESTINATION bin)
> ++endif(BUILD_PDP10)
> ++
> ++if(BUILD_PDP11)
> ++      include_directories(.)
> ++      add_executable(pdp11 ${pdp11_source_files}
${simulator_source_files} ${display_source_files}
> ++              ${vt_source_files})
> ++      set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} -DVM_PDP11")
> ++      target_link_libraries(pdp11 m)

ditto

> ++      if(ADD_NETWORK)
> ++              set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")
> ++              target_link_libraries(pdp11 pcap)
> ++              target_link_libraries(pdp11 pthread)

ditto

> ++      endif(ADD_NETWORK)
> ++      if(ADD_VIDEO)
> ++              set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS
"${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")
> ++              target_link_libraries(pdp11 SDL2)

ditto

> ++      endif(ADD_VIDEO)
> ++      install (TARGETS pdp11 DESTINATION bin)
> ++endif(BUILD_PDP11)
> ++
> ++if(BUILD_PDP15)
> ++      include_directories(.)
> ++      add_executable(pdp15 ${pdp18b_source_files}
${simulator_source_files})
> ++      set_target_properties(pdp15 PROPERTIES COMPILE_FLAGS "-DPDP15")
> ++      target_link_libraries(pdp15 m)

ditto

> ++      install (TARGETS pdp15 DESTINATION bin)
> ++endif(BUILD_PDP15)
> ++
> +--
> +1.9.1
> +
> diff --git a/package/simh/Config.in b/package/simh/Config.in
> new file mode 100644
> index 0000000..e38044a
> --- /dev/null
> +++ b/package/simh/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_SIMH
> +       bool "simh"
> +       depends on BR2_USE_MMU # fork()

Missing conditional dependency on thread support.

> +       help
> +         SIMH is a highly portable, multi-system simulator.
> +         Optional network support requires libpcap and pthreads, video
> +         support requires libSDL2.
> +         Only a subset of the available simulators is built.
> +
> +         http://simh.trailing-edge.com
> diff --git a/package/simh/simh.hash b/package/simh/simh.hash
> new file mode 100644
> index 0000000..cb6aeac
> --- /dev/null
> +++ b/package/simh/simh.hash
> @@ -0,0 +1,2 @@
> +# Locally computed:
> +sha256 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd
simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz
> diff --git a/package/simh/simh.mk b/package/simh/simh.mk
> new file mode 100644
> index 0000000..1b576f7
> --- /dev/null
> +++ b/package/simh/simh.mk
> @@ -0,0 +1,18 @@
> +###########################################################
#####################
> +#
> +# simh
> +#
> +###########################################################
#####################
> +
> +SIMH_VERSION = 946bfd329f9f6624364b266dc66005151c3fc018
> +SIMH_SITE = $(call github,simh,simh,$(SIMH_VERSION))
> +SIMH_LICENSE = MIT, GPLv2, zlib license
> +SIMH_LICENSE_FILES = doc/simh.doc Intel-Systems/common/i8088.c
sim_video.c
> +
> +define SIMH_MOVE_MAKEFILE
> +       mv $(@D)/makefile $(@D)/_simh_makefile

I think this hook is not needed since the generated makefile will be named
Makefile, so the case difference should not confuse make.

> +endef
> +
> +SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE

Missing conditional (and implicit) dependencies on libpcap and sdl2 at
least.

> +
> +$(eval $(cmake-package))
> --
> 1.9.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

[1] https://cmake.org/cmake/help/v3.5/command/find_package.html
[2] https://cmake.org/cmake/help/v3.5/module/FindPkgConfig.html


Regards,

--
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160817/c7346e24/attachment.html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/simh: new package
  2016-08-17 12:34 [Buildroot] [PATCH v3 1/1] package/simh: new package Lothar Felten
  2016-08-17 20:07 ` Samuel Martin
@ 2016-08-17 20:21 ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-08-17 20:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 17 Aug 2016 14:34:42 +0200, Lothar Felten wrote:
> This package provides the simh multi-system emulator.
> The simh makefile is replaced by a cmake project to handle cross compilation
> correctly. Only a subset of the available simulators is built.

I am a bit concerned by the fact that you are entirely replacing the
upstream build system by a CMake based one. Your patch adding CMake
based build is already 394 lines long, and doesn't support all the
simulators.

Indeed the upstream makefile seems a bit crazy. Have you talked with
upstream to see how those issues can be fixed?

I'm not sure we want to carry in Buildroot a completely new build
system for this package.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/simh: new package
  2016-08-17 20:07 ` Samuel Martin
@ 2016-08-18 21:45   ` Lothar Felten
  2016-08-19  7:15     ` Samuel Martin
  0 siblings, 1 reply; 5+ messages in thread
From: Lothar Felten @ 2016-08-18 21:45 UTC (permalink / raw)
  To: buildroot

Hi Samuel,

On 17.08.2016 22:07, Samuel Martin wrote:
> Hi,
>
>
> Buildroot automatically and always adds -D_LARGEFILE64_SOURCE flag.
> For a long-run patch, I would prefer the largefile check on the toolchain.
>
>> ++      find_library(MATH_LIBRARY m)
>
> Where is MATH_LIBRARY used?
> Is math lib. required? If so, add the required option to the
> find_package (see [1]).

lib math  is used in the main simulator.
I'd build a library but the main simulator has options which are 
selected by the target simulator at compile time.

I could not find a matching module for find_package in cmake-3.5 
(cmake/Modules/Find???.cmake)

Should I keep find_library?


>> ++find_library(PCAP_LIBRARY pcap)
>
> You may want to add the quiet option to find_package [1].
>
>> ++find_library(PTHREAD_LIBRARY pthread)
>
> Ditto

I replaced this one by pkg_check_modules(LIBPCAP libpcap)
It works in buildroot but not in ubuntu 14.04 beacuse the .pc file is 
missing.

For the libraries I now use:

find_package(Threads)

pkg_check_modules(LIBPNG libpng)
pkg_check_modules(SDL2 sdl2)
pkg_check_modules(LIBPCREPOSIX libpcreposix)
pkg_check_modules(LIBPCAP libpcap)

find_library(DL_LIBRARY dl)
find_library(RT_LIBRARY rt)
find_library(MATH_LIBRARY m)


[snip]

>
> s/\<m\>/${MATH_LIBRARY}/
> This target_link_library should be nested in a if(UNIX)-block.
>

I build many targets and I need to add libm to all of them. I haven't 
found a way to do target_link_library( * ${MATH_LIBRARY}) (i.e. for all 
targets)

Because there are other libs to add to each simulator, I wrote this 
function:

function(target_link_system_libs target)
	foreach(loop_var ${SYSTEM_LIBS})
		target_link_libraries(${target} ${loop_var})
	endforeach(loop_var)
endfunction()

and call that one for each target:

if(BUILD_I1620)
	add_executable(i1620 ${i1620_source_files} ${simulator_source_files})
	target_link_system_libs(i1620)
	install (TARGETS i1620 DESTINATION bin)
endif(BUILD_I1620)

Is there a better way to do this?

[snip]

>> +
>> diff --git a/package/simh/Config.in b/package/simh/Config.in
>> new file mode 100644
>> index 0000000..e38044a
>> --- /dev/null
>> +++ b/package/simh/Config.in
>> @@ -0,0 +1,10 @@
>> +config BR2_PACKAGE_SIMH
>> +       bool "simh"
>> +       depends on BR2_USE_MMU # fork()
>
> Missing conditional dependency on thread support.
>

I'll add the options:
   network support (depends libpcap and pthreads)
   video support (depends SDL2)	

>> +       help
>> +         SIMH is a highly portable, multi-system simulator.
>> +         Optional network support requires libpcap and pthreads, video
>> +         support requires libSDL2.
>> +         Only a subset of the available simulators is built.
>> +
>> +         http://simh.trailing-edge.com
>> diff --git a/package/simh/simh.hash b/package/simh/simh.hash
>> new file mode 100644
>> index 0000000..cb6aeac
>> --- /dev/null
>> +++ b/package/simh/simh.hash
>> @@ -0,0 +1,2 @@
>> +# Locally computed:
>> +sha256
> 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd
> simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz
>> diff --git a/package/simh/simh.mk <http://simh.mk>
> b/package/simh/simh.mk <http://simh.mk>
>> new file mode 100644
>> index 0000000..1b576f7
>> --- /dev/null
>> +++ b/package/simh/simh.mk <http://simh.mk>
>> @@ -0,0 +1,18 @@
>>
> +################################################################################
>> +#
>> +# simh
>> +#
>>
> +################################################################################
>> +
>> +SIMH_VERSION = 946bfd329f9f6624364b266dc66005151c3fc018
>> +SIMH_SITE = $(call github,simh,simh,$(SIMH_VERSION))
>> +SIMH_LICENSE = MIT, GPLv2, zlib license
>> +SIMH_LICENSE_FILES = doc/simh.doc Intel-Systems/common/i8088.c
> sim_video.c
>> +
>> +define SIMH_MOVE_MAKEFILE
>> +       mv $(@D)/makefile $(@D)/_simh_makefile
>
> I think this hook is not needed since the generated makefile will be
> named Makefile, so the case difference should not confuse make.
>

cmake generates Makefile (uppercase), simh has a makefile (lowercase).
For make the lowercase one has higher priority.
I found another way: out-of-source build.
I added SIMH_SUPPORTS_IN_SOURCE_BUILD = NO

(this also fixes the alpha binary conflicting with the alpha subdir, a 
simh project specific issue)

>> +endef
>> +
>> +SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE
>
> Missing conditional (and implicit) dependencies on libpcap and sdl2 at
> least.
>

simh will compile w/o libpcap, pthreads and SDL2.
I'll add the options in Config.in and appropriate DEPENDENCIES=.

>> +
>> +$(eval $(cmake-package))
>> --
>> 1.9.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net <mailto:buildroot@busybox.net>
>> http://lists.busybox.net/mailman/listinfo/buildroot
> <http://lists.busybox.net/mailman/listinfo/buildroot>
>
> [1] https://cmake.org/cmake/help/v3.5/command/find_package.html
> <https://cmake.org/cmake/help/v3.5/command/find_package.html>
> [2] https://cmake.org/cmake/help/v3.5/module/FindPkgConfig.html
> <https://cmake.org/cmake/help/v3.5/module/FindPkgConfig.html>
>
>
> Regards,
>
> --
> Samuel

Thanks,
Lothar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/simh: new package
  2016-08-18 21:45   ` Lothar Felten
@ 2016-08-19  7:15     ` Samuel Martin
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Martin @ 2016-08-19  7:15 UTC (permalink / raw)
  To: buildroot

Hi Lothar,

On Aug 18, 2016 11:45 PM, "Lothar Felten" <lothar.felten@gmail.com> wrote:
>
> Hi Samuel,
>
> On 17.08.2016 22:07, Samuel Martin wrote:
>>
>> Hi,
>>
>>
>>
>> Buildroot automatically and always adds -D_LARGEFILE64_SOURCE flag.
>> For a long-run patch, I would prefer the largefile check on the
toolchain.
>>
>>> ++      find_library(MATH_LIBRARY m)
>>
>>
>> Where is MATH_LIBRARY used?
>> Is math lib. required? If so, add the required option to the
>> find_package (see [1]).
>
>
> lib math  is used in the main simulator.
> I'd build a library but the main simulator has options which are selected
by the target simulator at compile time.

Well, my point was more about here you are setting the MATH_LIBRARY
variable, but you use "m" in the target_link_libraries calls below.
>
> I could not find a matching module for find_package in cmake-3.5
(cmake/Modules/Find???.cmake)

My bad, I read find_package instead of find_library :-/

>
> Should I keep find_library?
Yes, AFAIK there is no other way to get libm's details.
However, if this lib is mandatory, checking that it has correctly been
detected and bail out otherwise would be nice imho.

>
>
>
>>> ++find_library(PCAP_LIBRARY pcap)
>>
>>
>> You may want to add the quiet option to find_package [1].
>>
>>> ++find_library(PTHREAD_LIBRARY pthread)
>>
>>
>> Ditto
Gaah! Same mistake on my side :-/

>
>
> I replaced this one by pkg_check_modules(LIBPCAP libpcap)
> It works in buildroot but not in ubuntu 14.04 beacuse the .pc file is
missing.

Certainly because the pcap version from ubuntu is way too old compared to
the one provided by Buildroot.
You can get the details from the pcap-config script, but this implies using
a custom command in cmake.

>
> For the libraries I now use:
>
> find_package(Threads)
>
> pkg_check_modules(LIBPNG libpng)
> pkg_check_modules(SDL2 sdl2)
> pkg_check_modules(LIBPCREPOSIX libpcreposix)
> pkg_check_modules(LIBPCAP libpcap)
>
> find_library(DL_LIBRARY dl)
> find_library(RT_LIBRARY rt)
> find_library(MATH_LIBRARY m)
>
>
> [snip]
>
>
>>
>> s/\<m\>/${MATH_LIBRARY}/
>> This target_link_library should be nested in a if(UNIX)-block.
>>
>
> I build many targets and I need to add libm to all of them. I haven't
found a way to do target_link_library( * ${MATH_LIBRARY}) (i.e. for all
targets)

Well, there are several paths to do that.
The target_link_libraries command accepts several libs.
So, I tend to prefer setting a var. per target which stores all the libs to
link with, then call once target_link_libraries, e.g.

<snip>
set(foo_libs ${MATH_LIBRARY})
set(foo_libs ${RT_LIBRARY})
...
list(APPEND foo_libs ${PCAP_LIBRARY})
...
target_link_libraries(foo ${foo_libs})
</snip>

>
> Because there are other libs to add to each simulator, I wrote this
function:
>
> function(target_link_system_libs target)
>         foreach(loop_var ${SYSTEM_LIBS})
>                 target_link_libraries(${target} ${loop_var})
>         endforeach(loop_var)
> endfunction()
>
> and call that one for each target:
>
> if(BUILD_I1620)
>         add_executable(i1620 ${i1620_source_files}
${simulator_source_files})
>         target_link_system_libs(i1620)
>         install (TARGETS i1620 DESTINATION bin)
> endif(BUILD_I1620)
>
> Is there a better way to do this?

This way, I don't think so.

>
> [snip]
>
>
>>> +
>>> diff --git a/package/simh/Config.in b/package/simh/Config.in
>>> new file mode 100644
>>> index 0000000..e38044a
>>> --- /dev/null
>>> +++ b/package/simh/Config.in
>>> @@ -0,0 +1,10 @@
>>> +config BR2_PACKAGE_SIMH
>>> +       bool "simh"
>>> +       depends on BR2_USE_MMU # fork()
>>
>>
>> Missing conditional dependency on thread support.
>>
>
> I'll add the options:
>   network support (depends libpcap and pthreads)
>   video support (depends SDL2)
>
>>> +       help
>>> +         SIMH is a highly portable, multi-system simulator.
>>> +         Optional network support requires libpcap and pthreads, video
>>> +         support requires libSDL2.
>>> +         Only a subset of the available simulators is built.
>>> +
>>> +         http://simh.trailing-edge.com
>>> diff --git a/package/simh/simh.hash b/package/simh/simh.hash
>>> new file mode 100644
>>> index 0000000..cb6aeac
>>> --- /dev/null
>>> +++ b/package/simh/simh.hash
>>> @@ -0,0 +1,2 @@
>>> +# Locally computed:
>>> +sha256
>>
>> 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd
>> simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz
>>>
>>> diff --git a/package/simh/simh.mk <http://simh.mk>
>>
>> b/package/simh/simh.mk <http://simh.mk>
>>>
>>> new file mode 100644
>>> index 0000000..1b576f7
>>> --- /dev/null
>>> +++ b/package/simh/simh.mk <http://simh.mk>
>>> @@ -0,0 +1,18 @@
>>>
>> +###########################################################
#####################
>>>
>>> +#
>>> +# simh
>>> +#
>>>
>> +###########################################################
#####################
>>>
>>> +
>>> +SIMH_VERSION = 946bfd329f9f6624364b266dc66005151c3fc018
>>> +SIMH_SITE = $(call github,simh,simh,$(SIMH_VERSION))
>>> +SIMH_LICENSE = MIT, GPLv2, zlib license
>>> +SIMH_LICENSE_FILES = doc/simh.doc Intel-Systems/common/i8088.c
>>
>> sim_video.c
>>>
>>> +
>>> +define SIMH_MOVE_MAKEFILE
>>> +       mv $(@D)/makefile $(@D)/_simh_makefile
>>
>>
>> I think this hook is not needed since the generated makefile will be
>> named Makefile, so the case difference should not confuse make.
>>
>
> cmake generates Makefile (uppercase), simh has a makefile (lowercase).
> For make the lowercase one has higher priority.
Hmm... to bad :-(

> I found another way: out-of-source build.
> I added SIMH_SUPPORTS_IN_SOURCE_BUILD = NO

This is another valid way ;) (cleaner imho)

>
> (this also fixes the alpha binary conflicting with the alpha subdir, a
simh project specific issue)
>
>
>>> +endef
>>> +
>>> +SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE
>>
>>
>> Missing conditional (and implicit) dependencies on libpcap and sdl2 at
>> least.
>>
>
> simh will compile w/o libpcap, pthreads and SDL2.
> I'll add the options in Config.in and appropriate DEPENDENCIES=.
>
>>> +
>>> +$(eval $(cmake-package))
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot at busybox.net <mailto:buildroot@busybox.net>
>>> http://lists.busybox.net/mailman/listinfo/buildroot
>>
>> <http://lists.busybox.net/mailman/listinfo/buildroot>
>>
>> [1] https://cmake.org/cmake/help/v3.5/command/find_package.html
>> <https://cmake.org/cmake/help/v3.5/command/find_package.html>
>> [2] https://cmake.org/cmake/help/v3.5/module/FindPkgConfig.html
>> <https://cmake.org/cmake/help/v3.5/module/FindPkgConfig.html>
>>
>>

Regards,

--
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160819/001fad34/attachment.html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-19  7:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 12:34 [Buildroot] [PATCH v3 1/1] package/simh: new package Lothar Felten
2016-08-17 20:07 ` Samuel Martin
2016-08-18 21:45   ` Lothar Felten
2016-08-19  7:15     ` Samuel Martin
2016-08-17 20:21 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.