Skip to content

Commit

Permalink
revert libc detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Dec 29, 2019
1 parent 38a624c commit 90a741a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ $(DEPS_DIR):
$(binary): $(GEN_FILES) $(SOURCE_FILES) build/libdetect.a | $(BUILD_DIR) $(DEPS_DIR)
stable env ponyc $(PONYC_FLAGS) $(LINKER) $(SRC_DIR) -o $(BUILD_DIR) -b ponyup

build/libdetect.a: $(SRC_DIR)/detect_libc.c
@mkdir -p $(BUILD_DIR)
cc -c $^ -o $(BUILD_DIR)/detect_libc.o \
-ansi -Wall -Wextra -Wpedantic -fpic
ar -rcs $@ $(BUILD_DIR)/detect_libc.o

install: $(binary)
@echo "install"
mkdir -p $(DESTDIR)$(prefix)/bin
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ponyup update changelog-tool release-0.4.0

Ponyup is able to detect the CPU architecture and operating system of the platform on which it is running. The `--platform` option is used to override any field in the platform identifier (e.g. `x86_64-linux-gnu`).

It is currently necessary to pass `--platform=musl` on musl-based Linux systems to install the correct build of ponyc.

### Show installed package versions

The `ponyup show` command will display the installed package versions with the selected packages marked as green with an asterisk. If a more recent version is not installed, then the more recent version will be shown in yellow following the selected version.
Expand Down
12 changes: 0 additions & 12 deletions cmd/detect_libc.c

This file was deleted.

8 changes: 1 addition & 7 deletions cmd/packages.pony
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use "path:../build/"
use "lib:detect"

primitive Packages
fun apply(): Array[String] box =>
Expand All @@ -18,11 +16,7 @@ primitive Packages
elseif Platform.osx() then Darwin
else error
end
var libc: Libc =
if (name == "ponyc") and (os is Linux) then
// only detects the libc based on what ponyup was build with
if @detect_glibc[Bool]() then Glibc else Musl end
end
var libc: Libc = if (name == "ponyc") and (os is Linux) then Glibc end
for field in platform.values() do
match field
| "x86_64" | "x64" | "amd64" => cpu = AMD64
Expand Down
21 changes: 18 additions & 3 deletions test/main.pony
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ class _TestSelect is UnitTest
"select"

fun apply(h: TestHelper) ? =>
let platform = _TestPonyup.platform(h.env.vars)
let install_args: {(String): Array[String] val} val =
{(v) => ["update"; "ponyc"; v] }
{(v) => ["update"; "ponyc"; v; "--platform=" + platform] }

let link =
FilePath(
Expand Down Expand Up @@ -86,10 +87,12 @@ actor _SyncTester is PonyupNotify
_auth = auth
_pkg_name = pkg_name

let platform = _TestPonyup.platform(h.env.vars)
let http_get = HTTPGet(NetAuth(_auth), this)
for channel in ["nightly"; "release"].values() do
try
let pkg = Packages.from_fragments(_pkg_name, channel, "latest", [])?
let pkg = Packages.from_fragments(
_pkg_name, channel, "latest", platform.split("-"))?
let query_string: String =
Cloudsmith.repo_url(channel).clone()
.> append(Cloudsmith.query(pkg))
Expand Down Expand Up @@ -123,7 +126,9 @@ actor _SyncTester is PonyupNotify
_TestPonyup.exec(
_h,
pkg.name,
[ "update"; pkg.name; pkg.channel + "-" + pkg.version],
[ "update"; pkg.name; pkg.channel + "-" + pkg.version
"--platform=" + pkg.platform()
],
{()(self = recover tag this end)? =>
_TestPonyup.check_files(_h, pkg.name, pkg)?
self.run()
Expand All @@ -140,6 +145,16 @@ actor _SyncTester is PonyupNotify
_h.env.out.write(str)

primitive _TestPonyup
fun platform(vars: Array[String] box): String =>
let key = "PONYUP_PLATFORM"
var platform' = ""
for v in vars.values() do
if not v.contains(key) then continue end
platform' = v.substring(key.size().isize() + 1)
break
end
platform'

fun ponyup_bin(auth: AmbientAuth): FilePath? =>
FilePath(auth, "./build")?
.join(if Platform.debug() then "debug" else "release" end)?
Expand Down

0 comments on commit 90a741a

Please sign in to comment.