Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/Makefile b/Makefile
index 7b5b6a5..512c2f7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,63 +1,66 @@
MIX = mix
MYHTMLEX_CFLAGS = -g -O3 -std=c99 -pedantic -Wcomment -Wall
# we need to compile position independent code
MYHTMLEX_CFLAGS += -fpic -DPIC
# myhtmlex is using stpcpy, as defined in gnu string.h
# MYHTMLEX_CFLAGS += -D_GNU_SOURCE
# base on the same posix c source as myhtml
# MYHTMLEX_CFLAGS += -D_POSIX_C_SOURCE=199309
# turn warnings into errors
# MYHTMLEX_CFLAGS += -Werror
# ignore unused variables
# MYHTMLEX_CFLAGS += -Wno-unused-variable
# ignore unused parameter warnings
MYHTMLEX_CFLAGS += -Wno-unused-parameter
# set erlang include path
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
MYHTMLEX_CFLAGS += -I$(ERLANG_PATH)
# expecting myhtml fetched as a mix dependency
ifeq ($(wildcard c_src/myhtml),)
MYHTML_PATH = deps/myhtml
else
MYHTML_PATH = c_src/myhtml
endif
MYHTML_STATIC = $(MYHTML_PATH)/lib/libmyhtml_static.a
MYHTMLEX_CFLAGS += -I$(MYHTML_PATH)/include
# that would be used for a dynamically linked build
# MYHTMLEX_CFLAGS += -L$(MYHTML_PATH)/lib
MYHTMLEX_LDFLAGS = -shared
# platform specific
UNAME = $(shell uname -s)
ifeq ($(wilcard Makefile.$(UNAME)),)
include Makefile.$(UNAME)
endif
.PHONY: all myhtmlex
all: myhtmlex
myhtmlex: priv/myhtmlex.so
$(MIX) compile
deps/myhtml:
$(MIX) deps.get
$(MYHTML_STATIC): $(MYHTML_PATH)
$(MAKE) -C $(MYHTML_PATH) library
-priv/myhtmlex.so: src/myhtmlex.c $(MYHTML_STATIC)
+priv/myhtmlex.so: c_src/myhtmlex.c $(MYHTML_STATIC)
test -d priv || mkdir priv
$(CC) $(MYHTMLEX_CFLAGS) $(MYHTMLEX_LDFLAGS) -o $@ $< $(MYHTML_STATIC)
-clean:
+clean: clean-myhtml
$(MIX) clean
$(RM) priv/myhtmlex.so
clean-myhtml:
$(MAKE) -C $(MYHTML_PATH) clean
+publish: clean
+ $(MIX) hex.publish
+
diff --git a/src/myhtmlex.c b/c_src/myhtmlex.c
similarity index 100%
rename from src/myhtmlex.c
rename to c_src/myhtmlex.c
diff --git a/src/myhtmlex.h b/c_src/myhtmlex.h
similarity index 100%
rename from src/myhtmlex.h
rename to c_src/myhtmlex.h
diff --git a/mix.exs b/mix.exs
index b7084e7..fc59f80 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,71 +1,70 @@
defmodule Mix.Tasks.Compile.Myhtml do
def run(_) do
if match? {:win32, _}, :os.type do
IO.warn "Windows is not yet a target."
exit(1)
else
{result, _error_code} = System.cmd("make", ["priv/myhtmlex.so"], stderr_to_stdout: true)
IO.binwrite result
end
:ok
end
end
defmodule Myhtmlex.Mixfile do
use Mix.Project
def project do
[
app: :myhtmlex,
version: "0.1.0",
elixir: "~> 1.5",
compilers: [:myhtml, :elixir, :app],
start_permanent: Mix.env == :prod,
description: "A module to decode HTML into a tree, porting all properties of the underlying library myhtml, being fast and correct in regards to the html spec.",
package: package(),
deps: deps()
]
end
def package do
[
maintainers: ["Lukas Rieder"],
licenses: ["GNU LGPL"],
links: %{
"Github" => "https://github.com/Overbryd/myhtmlex",
"Issues" => "https://github.com/Overbryd/myhtmlex/issues",
"MyHTML" => "https://github.com/lexborisov/myhtml"
},
files: [
"lib",
- "src",
"c_src",
"Makefile",
"Makefile.Darwin",
"Makefile.Linux",
"mix.exs",
"README.md",
"LICENSE"
]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# in dev environment, manage myhtml c library with mix
{:myhtml, github: "lexborisov/myhtml", branch: "master", app: false, only: :dev},
# documentation helpers
{:ex_doc, ">= 0.0.0", only: :dev},
# benchmarking helpers
{:benchfella, "~> 0.3.0", only: :dev}
]
end
end

File Metadata

Mime Type
text/x-diff
Expires
Sat, Oct 31, 1:10 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801431
Default Alt Text
(4 KB)

Event Timeline