Skip to content

Commit 3457861

Browse files
committed
Skip major/minor/makedev on WASM
1 parent fb5da78 commit 3457861

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/System/PosixCompat/Extensions.hsc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module System.PosixCompat.Extensions (
1212
) where
1313

1414

15-
#ifndef mingw32_HOST_OS
15+
#if !(defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH))
1616
#include "HsUnixCompat.h"
1717
#endif
1818

@@ -27,7 +27,7 @@ type CMinor = CUInt
2727
--
2828
-- The portable implementation always returns @0@.
2929
deviceMajor :: DeviceID -> CMajor
30-
#ifdef mingw32_HOST_OS
30+
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
3131
deviceMajor _ = 0
3232
#else
3333
deviceMajor dev = unix_major dev
@@ -39,7 +39,7 @@ foreign import ccall unsafe "unix_major" unix_major :: CDev -> CUInt
3939
--
4040
-- The portable implementation always returns @0@.
4141
deviceMinor :: DeviceID -> CMinor
42-
#ifdef mingw32_HOST_OS
42+
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
4343
deviceMinor _ = 0
4444
#else
4545
deviceMinor dev = unix_minor dev
@@ -49,7 +49,7 @@ foreign import ccall unsafe "unix_minor" unix_minor :: CDev -> CUInt
4949

5050
-- | Creates a 'DeviceID' for a device file given a major and minor number.
5151
makeDeviceID :: CMajor -> CMinor -> DeviceID
52-
#ifdef mingw32_HOST_OS
52+
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
5353
makeDeviceID _ _ = 0
5454
#else
5555
makeDeviceID ma mi = unix_makedev ma mi

unix-compat.cabal

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ Library
6969

7070
else
7171
build-depends: unix >= 2.7.2.0 && < 2.9
72-
include-dirs: include
73-
includes: HsUnixCompat.h
74-
install-includes: HsUnixCompat.h
75-
c-sources: cbits/HsUnixCompat.c
72+
if !arch(wasm32)
73+
include-dirs: include
74+
includes: HsUnixCompat.h
75+
install-includes: HsUnixCompat.h
76+
c-sources: cbits/HsUnixCompat.c
7677
if os(solaris)
7778
cc-options: -DSOLARIS
7879

0 commit comments

Comments
 (0)