Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opam packaging #111

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
##


VERSION = 0.42
VERSION = \
$(eval VERSION := $$(shell sed -ne 's/^version: *"\(.*\)"/\1/p' flexdll.opam))$(VERSION)

all: flexlink.exe support

OCAML_CONFIG_FILE=$(shell cygpath -ad "$(shell ocamlopt -where 2>/dev/null)/Makefile.config" 2>/dev/null)
Expand Down Expand Up @@ -164,11 +166,25 @@ flexlink.exe: $(OBJS) $(RES)
rm -f flexlink.exe
$(RES_PREFIX) $(OCAMLOPT) -o flexlink.exe $(LINKFLAGS) $(OBJS)

version.res: version.rc
$(RES_PREFIX) rc version.rc
COMMA = ,
FULL_VERSION = $(wordlist 1, 4, $(subst ., ,$(VERSION)) 0 0 0)
FLEXDLL_VERSION = $(subst $(SPACE),$(COMMA),$(FULL_VERSION))
FLEXDLL_VERSION_STR = $(subst $(SPACE),.,$(FULL_VERSION))

RC_FLAGS = \
/d FLEXDLL_VERSION=$(FLEXDLL_VERSION) \
/d FLEXDLL_VERSION_STR="$(FLEXDLL_VERSION_STR)"

# cf. https://sourceware.org/bugzilla/show_bug.cgi?id=27843
WINDRES_FLAGS = \
-D FLEXDLL_VERSION=$(FLEXDLL_VERSION) \
-D FLEXDLL_VERSION_STR=\\\"$(FLEXDLL_VERSION_STR)\\\"

version.res: version.rc flexdll.opam
$(RES_PREFIX) rc /nologo $(RC_FLAGS) $<

version_res.o: version.rc
$(TOOLPREF)windres version.rc version_res.o
version_res.o: version.rc flexdll.opam
$(TOOLPREF)windres $(WINDRES_FLAGS) $< $@

flexdll_msvc.obj: flexdll.h flexdll.c
$(MSVC_PREFIX) $(MSVCC) /DMSVC -c /Fo"flexdll_msvc.obj" flexdll.c
Expand Down Expand Up @@ -252,7 +268,7 @@ package_src:
rm -Rf flexdll-$(VERSION)
mkdir flexdll-$(VERSION)
mkdir flexdll-$(VERSION)/test
cp -a $(filter-out version.ml,$(OBJS:Compat.ml=Compat.ml.in)) Makefile msvs-detect $(COMMON_FILES) version.rc flexdll-$(VERSION)/
cp -a $(filter-out version.ml,$(OBJS:Compat.ml=Compat.ml.in)) Makefile msvs-detect $(COMMON_FILES) version.rc flexdll.install flexdll.opam flexdll-$(VERSION)/
cp -aR test/Makefile test/*.c flexdll-$(VERSION)/test/
tar czf $(PACKAGE) flexdll-$(VERSION)
rm -Rf flexdll-$(VERSION)
Expand All @@ -268,13 +284,14 @@ upload_src: package_src upload
# Binary package

PACKAGE_BIN = flexdll-bin-$(VERSION)$(PACKAGE_BIN_SUFFIX).zip
FLEXLINK_BIN = flexlink-bin-$(VERSION)$(PACKAGE_BIN_SUFFIX).zip
INSTALLER = flexdll-$(VERSION)$(PACKAGE_BIN_SUFFIX)-setup.exe

package_bin:
$(MAKE) clean all
rm -f $(PACKAGE_BIN)
zip $(PACKAGE_BIN) $(COMMON_FILES) \
flexlink.exe flexdll_*.obj flexdll_*.o flexdll.c flexdll_initer.c
rm -f $(PACKAGE_BIN) $(FLEXLINK_BIN)
zip $(PACKAGE_BIN) $(COMMON_FILES) flexlink.exe flexdll_*.obj flexdll_*.o
zip $(FLEXLINK_BIN) $(COMMON_FILES) flexlink.exe Makefile flexdll-bin.install flexdll-bin.opam

do_upload_bin:
rsync $(PACKAGE_BIN) $(URL)
Expand Down
2 changes: 2 additions & 0 deletions appveyor_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ if [ "$ARTEFACTS" = 'yes' ] ; then
VERSION="$(sed -ne 's/^VERSION *= *//p' Makefile)"
if [ "$SUFFIX" != "$VERSION" ] ; then
mv "flexdll-bin-$VERSION.zip" "flexdll-bin-$SUFFIX.zip"
mv "flexlink-bin-$VERSION.zip" "flexlink-bin-$SUFFIX.zip"
mv "flexdll-$VERSION-setup.exe" "flexdll-$SUFFIX-setup.exe"
fi
appveyor PushArtifact "flexdll-$SUFFIX-setup.exe"
appveyor PushArtifact "flexdll-bin-$SUFFIX.zip"
appveyor PushArtifact "flexlink-bin-$SUFFIX.zip"

popd &> /dev/null
fi
20 changes: 20 additions & 0 deletions flexdll-bin.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
libexec: [
"flexlink.exe"
]
lib: [
"default.manifest"
"default_amd64.manifest"
"flexdll.h"
"?flexdll_mingw.o"
"?flexdll_initer_mingw.o"
"?flexdll_mingw64.o"
"?flexdll_initer_mingw64.o"
"?flexdll_msvc.obj"
"?flexdll_initer_msvc.obj"
"?flexdll_msvc64.obj"
"?flexdll_initer_msvc64.obj"
"?flexdll_cygwin.o"
"?flexdll_initer_cygwin.o"
"?flexdll_cygwin64.o"
"?flexdll_initer_cygwin64.o"
]
30 changes: 30 additions & 0 deletions flexdll-bin.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
opam-version: "2.0"
version: "0.42"
authors: "Alain Frisch"
maintainer: "David Allsopp <[email protected]>"
bug-reports: "https://github.com/ocaml/flexdll/issues"
homepage: "https://github.com/ocaml/flexdll#readme"
license: "Zlib"
synopsis: "FlexDLL Binary Release"
description: "Precompiled flexlink.exe binary (built using 32-bit mingw-w64)
required for building OCaml 3.11.0-4.02.3"
build: [
["./flexlink.exe" "-vnum"] {dev}
[make "MSVC_DETECT=0" "support"
"CHAINS=mingw" {ocaml-option-32bit:installed & ocaml-option-mingw:installed}
"CHAINS=mingw64" {!ocaml-option-32bit:installed & ocaml-option-mingw:installed}
"CHAINS=msvc" {ocaml-option-32bit:installed & ocaml-option-msvc:installed}
"CHAINS=msvc64" {!ocaml-option-32bit:installed & ocaml-option-msvc:installed}
"CHAINS=cygwin" {ocaml-option-32bit:installed & !ocaml-option-mingw:installed & !ocaml-option-msvc:installed}
"CHAINS=cygwin64" {!ocaml-option-32bit:installed & !ocaml-option-mingw:installed & !ocaml-option-msvc:installed}]
]
depopts: [
"ocaml-option-32bit"
"ocaml-option-mingw"
"ocaml-option-msvc"
]
available: os = "win32" | os = "cygwin"
flags: avoid-version
post-messages: [
"This package cannot be pinned to a repository commit" {dev & failure}
]
14 changes: 14 additions & 0 deletions flexdll.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
share: [
"Makefile"
"cmdline.ml"
"coff.ml"
"Compat.ml.in"
"create_dll.ml"
"default.manifest"
"default_amd64.manifest"
"flexdll.c"
"flexdll.h"
"flexdll_initer.c"
"reloc.ml"
"version.rc"
]
11 changes: 11 additions & 0 deletions flexdll.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
opam-version: "2.0"
version: "0.42"
authors: "Alain Frisch"
maintainer: "David Allsopp <[email protected]>"
bug-reports: "https://github.com/ocaml/flexdll/issues"
dev-repo: "git+https://github.com/ocaml/flexdll.git"
homepage: "https://github.com/ocaml/flexdll#readme"
license: "Zlib"
synopsis: "FlexDLL Sources"
description: "Source package for FlexDLL. Installs the required files for
bootstrapping FlexDLL as part of an OCaml build."
19 changes: 19 additions & 0 deletions flexlink.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bin: [
"flexlink.exe"
]
lib_root: [
"default.manifest" {"ocaml/default.manifest"}
"default_amd64.manifest" {"ocaml/default_amd64.manifest"}
"?flexdll_mingw.o" {"ocaml/flexdll_mingw.o"}
"?flexdll_initer_mingw.o" {"ocaml/flexdll_initer_mingw.o"}
"?flexdll_mingw64.o" {"ocaml/flexdll_mingw64.o"}
"?flexdll_initer_mingw64.o" {"ocaml/flexdll_initer_mingw64.o"}
"?flexdll_msvc.obj" {"ocaml/flexdll_msvc.obj"}
"?flexdll_initer_msvc.obj" {"ocaml/flexdll_initer_msvc.obj"}
"?flexdll_msvc64.obj" {"ocaml/flexdll_msvc64.obj"}
"?flexdll_initer_msvc64.obj" {"ocaml/flexdll_initer_msvc64.obj"}
"?flexdll_cygwin.o" {"ocaml/flexdll_cygwin.o"}
"?flexdll_initer_cygwin.o" {"ocaml/flexdll_initer_cygwin.o"}
"?flexdll_cygwin64.o" {"ocaml/flexdll_cygwin64.o"}
"?flexdll_initer_cygwin64.o" {"ocaml/flexdll_initer_cygwin64.o"}
]
31 changes: 31 additions & 0 deletions flexlink.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
opam-version: "2.0"
version: "0.42"
authors: "Alain Frisch"
maintainer: "David Allsopp <[email protected]>"
bug-reports: "https://github.com/ocaml/flexdll/issues"
dev-repo: "git+https://github.com/ocaml/flexdll.git"
homepage: "https://github.com/ocaml/flexdll#readme"
license: "Zlib"
synopsis: "FlexDLL Linker"
description: "Used after compiling OCaml with the precompiled binary release
of FlexDLL to rebuild and install flexlink.exe using the new OCaml compiler."
build-env: PATH += "%{lib}%/%{flexdll-bin:installed?flexdll-bin:ocaml}%"
build: [
[make "MSVC_DETECT=0" "support" "flexlink.exe"
"CHAINS=mingw" {ocaml-option-32bit:installed & ocaml-option-mingw:installed}
"CHAINS=mingw64" {!ocaml-option-32bit:installed & ocaml-option-mingw:installed}
"CHAINS=msvc" {ocaml-option-32bit:installed & ocaml-option-msvc:installed}
"CHAINS=msvc64" {!ocaml-option-32bit:installed & ocaml-option-msvc:installed}
"CHAINS=cygwin" {ocaml-option-32bit:installed & !ocaml-option-mingw:installed & !ocaml-option-msvc:installed}
"CHAINS=cygwin64" {!ocaml-option-32bit:installed & !ocaml-option-mingw:installed & !ocaml-option-msvc:installed}]
]
depends: [
"ocaml"
"flexdll-bin" {= _:version}
]
depopts: [
"ocaml-option-32bit"
"ocaml-option-mingw"
"ocaml-option-msvc"
]
available: (opam-version >= "2.2" & os = "win32") | os = "cygwin"
8 changes: 4 additions & 4 deletions version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,42
PRODUCTVERSION 0,0,0,42
FILEVERSION FLEXDLL_VERSION
PRODUCTVERSION FLEXDLL_VERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
Expand All @@ -21,8 +21,8 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileVersion", "0.0.0.42"
VALUE "ProductVersion", "0.0.0.42"
VALUE "FileVersion", FLEXDLL_VERSION_STR
VALUE "ProductVersion", FLEXDLL_VERSION_STR
VALUE "ProductName", "FlexDLL"
VALUE "FileDescription", "FlexDLL Linker"
VALUE "LegalCopyright", "Institut National de Recherche en Informatique et en Automatique"
Expand Down