Skip to contentSkip to conversation

package/simh: new package

PATCH New Lothar Felten 3 participants 5 messages Aug 17, 2016 – Aug 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/simh: new package

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.

---
 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
package/Config.in +1 -0
index 645fa29..993b446 100644
@@ -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"
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +394 -0

394 lines not on this page · raw message

package/simh/Config.in new file +10 -0
new file mode 100644
index 0000000..e38044a
@@ -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
package/simh/simh.hash new file +2 -0
new file mode 100644
index 0000000..cb6aeac
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz
package/simh/simh.mk new file +18 -0
new file mode 100644
index 0000000..1b576f7
@@ -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))
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/1 package/simh: new package

Hi,

Quoted 3 lines · Lothar Felten

This package provides the simh multi-system emulator. The simh makefile is replaced by a cmake project to handle cross

compilation

Quoted 6 lines

correctly. Only a subset of the available simulators is built.

---
 package/Config.in                                  |   1 +
 .../0001-add-cmake-build-for-cross-compile.patch   | 394

+++++++++++++++++++++

Quoted 5 lines
 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

Review

Quoted 17 lines
 create mode 100644 package/simh/Config.in
 create mode 100644 package/simh/simh.hash
 create mode 100644 package/simh/simh.mk
package/Config.in +1 -0
index 645fa29..993b446 100644
@@ -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"
(quoted diff) +0 -0

b/package/simh/0001-add-cmake-build-for-cross-compile.patch

package/simh/0001-add-cmake-build-for-cross-compile.patch line 6

Quoted 11 lines

new file mode 100644
index 0000000..577d5e5

package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
@@ -0,0 +1,394 @@
+From 29a841225a5e931e26a309f612333a4d98aca720 Mon Sep 17 00:00:00 2001
+From: Lothar Felten <[email protected]>
+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

package/simh/0001-add-cmake-build-for-cross-compile.patch line 7

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
+architecture. This patch adds CMakeLists.txt so the simh project can be

built

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
+with cmake.
+Only a reduced set of simulators will be built.
+
+Signed-off-by: Lothar Felten <[email protected]>
+---
+ CMakeLists.txt | 369 ++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++

Quoted 59 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +59 -0
+ 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 <[email protected]>
++#
++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

package/simh/0001-add-cmake-build-for-cross-compile.patch line 82

Quoted 10 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +10 -0
++#
++#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.

package/simh/0001-add-cmake-build-for-cross-compile.patch line 83

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      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]).

package/simh/0001-add-cmake-build-for-cross-compile.patch line 89

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++endif(UNIX)
++
++#
++# NETWORK?
++#
++find_library(PCAP_LIBRARY pcap)

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

package/simh/0001-add-cmake-build-for-cross-compile.patch line 90

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++find_library(PTHREAD_LIBRARY pthread)

Ditto

Quoted 4 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +4 -0
++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)

package/simh/0001-add-cmake-build-for-cross-compile.patch line 104

Quoted 10 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +10 -0
++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

package/simh/0001-add-cmake-build-for-cross-compile.patch line 107

Quoted 3 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +3 -0
++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>

package/simh/0001-add-cmake-build-for-cross-compile.patch line 109

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++              PATH_SUFFIXES SDL2)
++      set(VIDEO_FLAGS "-I${SDL2_INCLUDE_DIR} -DHAVE_LIBSDL

-DUSE_SIM_VIDEO -DUSE_DISPLAY")

Quoted 175 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +175 -0
++      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

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 10 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +10 -0
++      PDP18B/pdp18b_sys.c
++      PDP18B/pdp18b_tt1.c
++)
++
++#
++# BUILD TARGETS
++#
++if(BUILD_IBM1130)
++      include_directories(.)
++      add_executable(ibm1130 ${ibm1130_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 295

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      #set_target_properties(ibm1130 PROPERTIES COMPILE_FLAGS "

-DGUI_SUPPORT -lgdi32")#TODO

package/simh/0001-add-cmake-build-for-cross-compile.patch line 296

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      target_link_libraries(ibm1130 m)

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

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS ibm1130 DESTINATION bin)
++endif(BUILD_IBM1130)
++
++if(BUILD_NOVA)
++      include_directories(.)
++      add_executable(nova ${nova_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 303

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      target_link_libraries(nova m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      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})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 311

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      if(ADD_VIDEO)
++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} -DDISPLAY_TYPE=DIS_TYPE30")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 312

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} -DPIX_SCALE=RES_HALF")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 313

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++              set_target_properties(pdp1 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 316

Quoted 3 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +3 -0
++              target_link_libraries(pdp1 SDL2)
++      endif(ADD_VIDEO)
++      target_link_libraries(pdp1 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS pdp1 DESTINATION bin)
++endif(BUILD_PDP1)
++
++if(BUILD_PDP4)
++      include_directories(.)
++      add_executable(pdp4 ${pdp18b_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 324

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      set_target_properties(pdp4 PROPERTIES COMPILE_FLAGS "-DPDP4")
++      target_link_libraries(pdp4 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS pdp4 DESTINATION bin)
++endif(BUILD_PDP4)
++
++if(BUILD_PDP7)
++      include_directories(.)
++      add_executable(pdp7 ${pdp18b_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 332

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      set_target_properties(pdp7 PROPERTIES COMPILE_FLAGS "-DPDP7")
++      target_link_libraries(pdp7 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS pdp7 DESTINATION bin)
++endif(BUILD_PDP7)
++
++if(BUILD_PDP8)
++      include_directories(.)
++      add_executable(pdp8 ${pdp8_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 339

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      target_link_libraries(pdp8 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 6 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS pdp8 DESTINATION bin)
++endif(BUILD_PDP8)
++
++if(BUILD_PDP9)
++      include_directories(.)
++      add_executable(pdp9 ${pdp18b_source_files}

${simulator_source_files})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 347

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      set_target_properties(pdp9 PROPERTIES COMPILE_FLAGS "-DPDP9")
++      target_link_libraries(pdp9 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 7 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +7 -0
++      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})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 355

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} -DVM_PDP10 -DUSE_INT64")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 356

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      target_link_libraries(pdp10 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 3 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +3 -0
++      if(ADD_NETWORK)
++              message("PDP10 NETWORK!!!!")
++              set_target_properties(pdp10 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 360

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++              target_link_libraries(pdp10 pcap)

use the right cmake variable here ${PCAP_LIBRARY}

package/simh/0001-add-cmake-build-for-cross-compile.patch line 361

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++              target_link_libraries(pdp10 pthread)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 7 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +7 -0
++      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}

package/simh/0001-add-cmake-build-for-cross-compile.patch line 370

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++              ${vt_source_files})
++      set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} -DVM_PDP11")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 371

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++      target_link_libraries(pdp11 m)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch line 373

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      if(ADD_NETWORK)
++              set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} ${NETWORK_FLAGS}")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 375

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++              target_link_libraries(pdp11 pcap)
++              target_link_libraries(pdp11 pthread)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 3 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +3 -0
++      endif(ADD_NETWORK)
++      if(ADD_VIDEO)
++              set_target_properties(pdp11 PROPERTIES COMPILE_FLAGS

"${CMAKE_C_FLAGS} ${VIDEO_FLAGS}")

package/simh/0001-add-cmake-build-for-cross-compile.patch line 379

Quoted 1 line
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +1 -0
++              target_link_libraries(pdp11 SDL2)

ditto

package/simh/0001-add-cmake-build-for-cross-compile.patch

Quoted 7 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +7 -0
++      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})

package/simh/0001-add-cmake-build-for-cross-compile.patch line 388

Quoted 2 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +2 -0
++      set_target_properties(pdp15 PROPERTIES COMPILE_FLAGS "-DPDP15")
++      target_link_libraries(pdp15 m)

ditto

Quoted 12 lines
package/simh/0001-add-cmake-build-for-cross-compile.patch new file +6 -0
++      install (TARGETS pdp15 DESTINATION bin)
++endif(BUILD_PDP15)
++
+--
+1.9.1
+
package/simh/Config.in new file +0 -0
new file mode 100644
index 0000000..e38044a

package/simh/Config.in line 3

Quoted 3 lines
package/simh/Config.in new file +3 -0
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_SIMH
+       bool "simh"
+       depends on BR2_USE_MMU # fork()

Missing conditional dependency on thread support.

Quoted 13 lines
package/simh/Config.in new file +7 -0
+       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
package/simh/simh.hash new file +0 -0
new file mode 100644
index 0000000..cb6aeac

package/simh/simh.hash line 2

Quoted 2 lines
package/simh/simh.hash new file +2 -0
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd

simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz

package/simh/simh.mk line 1

Quoted 7 lines
package/simh/simh.mk new file +1 -0
new file mode 100644
index 0000000..1b576f7
@@ -0,0 +1,18 @@
+###########################################################

#####################

package/simh/simh.mk

Quoted 4 lines
package/simh/simh.mk new file +4 -0
+#
+# simh
+#
+###########################################################

#####################

package/simh/simh.mk

Quoted 5 lines
package/simh/simh.mk new file +5 -0
+
+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

package/simh/simh.mk line 13

Quoted 3 lines
package/simh/simh.mk new file +3 -0
+
+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.

package/simh/simh.mk line 16

Quoted 3 lines
package/simh/simh.mk new file +3 -0
+endef
+
+SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE

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

Quoted 9 lines
package/simh/simh.mk new file +2 -1
+
+$(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>

#4 lore raw

PATCH v3 1/1 package/simh: new package

In reply to Lothar Felten

Hello,

Quoted 3 lines · Lothar Felten

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH v3 1/1 package/simh: new package

In reply to Samuel Martin

Hi Samuel,

Quoted 11 lines · Samuel Martin

Hi,

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

Quoted 1 line

++ 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?

Quoted 7 lines
Quoted 1 line

++find_library(PCAP_LIBRARY pcap)

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

Quoted 1 line

++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]

Quoted 4 lines

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]

Quoted 4 lines
Quoted 4 lines
(quoted diff) +1 -0
+
package/simh/Config.in new file +0 -0
new file mode 100644
index 0000000..e38044a
Quoted 9 lines

package/simh/Config.in line 3

Quoted 6 lines
package/simh/Config.in new file +3 -0
@@ -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)

Quoted 37 lines
Quoted 13 lines
package/simh/Config.in new file +7 -0
+       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
package/simh/simh.hash new file +0 -0
new file mode 100644
index 0000000..cb6aeac

package/simh/simh.hash line 2

Quoted 2 lines
package/simh/simh.hash new file +2 -0
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256

508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz

<http://simh.mk>

Quoted 1 line
<http://simh.mk> renamed from package/simh/simh.mk +0 -0

b/package/simh/simh.mk <http://simh.mk>

package/simh/simh.mk <http://simh.mk>

Quoted 6 lines

new file mode 100644
index 0000000..1b576f7

package/simh/simh.mk <http://simh.mk> new file +0 -0
@@ -0,0 +1,18 @@

+################################################################################

package/simh/simh.mk <http://simh.mk> line 3

Quoted 4 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+#
+# simh
+#

+################################################################################

package/simh/simh.mk <http://simh.mk> line 8

Quoted 5 lines
package/simh/simh.mk <http://simh.mk> new file +5 -0
+
+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

Quoted 7 lines

package/simh/simh.mk <http://simh.mk> line 11

Quoted 3 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+
+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)

Quoted 7 lines

package/simh/simh.mk <http://simh.mk> line 14

Quoted 3 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+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=.

Quoted 17 lines
Quoted 9 lines
package/simh/simh.mk <http://simh.mk> new file +2 -1
+
+$(eval $(cmake-package))
--

1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
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>

Quoted 4 lines

Regards,

--
Samuel

Thanks,
Lothar

#3 lore raw

PATCH v3 1/1 package/simh: new package

Hi Lothar,

Quoted 11 lines · Lothar Felten

Hi Samuel,

Quoted 7 lines · Samuel Martin

Hi,

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

toolchain.

Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

++ 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.

Quoted 2 lines

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 :-/

Quoted 2 lines

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.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

++find_library(PCAP_LIBRARY pcap)

Quoted 6 lines
Quoted 6 lines

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

Quoted 1 line

++find_library(PTHREAD_LIBRARY pthread)

Ditto

Gaah! Same mistake on my side :-/

Quoted 4 lines

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.

Quoted 19 lines

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]

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

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>

Quoted 2 lines

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

function:

Quoted 11 lines

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})

Quoted 5 lines

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.

Quoted 19 lines

[snip]

Quoted 5 lines
Quoted 5 lines
(quoted diff) +1 -0
+
package/simh/Config.in new file +0 -1
new file mode 100644
index 0000000..e38044a
--- /dev/null
Quoted 9 lines

package/simh/Config.in line 3

Quoted 5 lines

+++ b/package/simh/Config.in

package/simh/Config.in new file +3 -0
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_SIMH
+       bool "simh"
+       depends on BR2_USE_MMU # fork()

Missing conditional dependency on thread support.

Quoted 34 lines

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

Quoted 30 lines
Quoted 13 lines
package/simh/Config.in new file +7 -0
+       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
package/simh/simh.hash new file +0 -0
new file mode 100644
index 0000000..cb6aeac

package/simh/simh.hash line 2

Quoted 2 lines
package/simh/simh.hash new file +2 -0
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256

508667d212c572d3a5bdbd78a6d5d9fc0923784d5a7f06e01f3bf9c27f514bbd simh-946bfd329f9f6624364b266dc66005151c3fc018.tar.gz

<http://simh.mk>

Quoted 2 lines
<http://simh.mk> renamed from package/simh/simh.mk +0 -0

b/package/simh/simh.mk <http://simh.mk>

package/simh/simh.mk <http://simh.mk>

Quoted 7 lines

new file mode 100644
index 0000000..1b576f7

package/simh/simh.mk <http://simh.mk> new file +0 -0
@@ -0,0 +1,18 @@

+###########################################################

#####################

Quoted 6 lines
Quoted 6 lines

package/simh/simh.mk <http://simh.mk> line 3

Quoted 5 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+#
+# simh
+#

+###########################################################

#####################

Quoted 18 lines
Quoted 9 lines

package/simh/simh.mk <http://simh.mk> line 8

Quoted 6 lines
package/simh/simh.mk <http://simh.mk> new file +5 -0
+
+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

Quoted 1 line
Quoted 8 lines

package/simh/simh.mk <http://simh.mk>

Quoted 3 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+
+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.

Quoted 2 lines

cmake generates Makefile (uppercase), simh has a makefile (lowercase). For make the lowercase one has higher priority.

Hmm... to bad :-(

Quoted 2 lines

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

This is another valid way ;) (cleaner imho)

Quoted 2 lines

(this also fixes the alpha binary conflicting with the alpha subdir, a

simh project specific issue)

Quoted 11 lines
Quoted 10 lines

package/simh/simh.mk <http://simh.mk>

Quoted 5 lines
package/simh/simh.mk <http://simh.mk> new file +3 -0
+endef
+
+SIMH_PRE_BUILD_HOOKS += SIMH_MOVE_MAKEFILE

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

Quoted 21 lines

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

Quoted 18 lines
Quoted 9 lines

+
+$(eval $(cmake-package))
--
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
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>