Skip to content

OBS file generation #907

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

Draft
wants to merge 4 commits into
base: pharo-10
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
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,23 @@ include(cmake/vmmaker.cmake)
#Generating config file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/pharovm/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/build/include/pharovm/config.h)

#Generate obs config files, generating a debian-like changelog from our current CHANGELOG.md file
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md" CHANGELOG_STRING)
file(GLOB OBS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/packaging/obs/*")
foreach(OBS_FILE ${OBS_FILES})
get_filename_component(OBS_FILE_NAME "${OBS_FILE}" NAME)
message(STATUS "Configuring OBS file: ${OBS_FILE_NAME}")

if(OBS_FILE_NAME MATCHES "pharo.*")
#replace pharo by pharo-vm-{full_version}
string(REGEX REPLACE "pharo" "pharo-vm-${PharoVM_VERSION_MAJOR}.${PharoVM_VERSION_MINOR}" OBS_TARGET_NAME ${OBS_FILE_NAME})
else()
set(OBS_TARGET_NAME ${OBS_FILE_NAME})
endif()
message(STATUS "Writing OBS file to: ${CMAKE_CURRENT_BINARY_DIR}/obs/${OBS_TARGET_NAME}")
configure_file("${OBS_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/obs/${OBS_TARGET_NAME}" @ONLY)
endforeach()

message(STATUS "C Compiler: ${CMAKE_C_COMPILER}")
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "Resource Compiler: ${CMAKE_RC_COMPILER}")
Expand Down
12 changes: 11 additions & 1 deletion cmake/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ file(GLOB SUPPORT_CMAKE_FILES

install(FILES
"CMakeLists.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md"
"${CMAKE_CURRENT_BINARY_DIR}/version.info"
${SUPPORT_CMAKE_FILES}
DESTINATION pharo-vm
COMPONENT c-src
Expand All @@ -78,7 +80,15 @@ install(
COMPONENT include
FILES_MATCHING PATTERN *.h)

set(CPACK_PACKAGE_DESCRIPTION "${APPNAME} Headless VM for ${FULL_PLATFORM_NAME}")
#List all obs files
file(GLOB OBS_FILES "${CMAKE_CURRENT_BINARY_DIR}/obs/*")

install(
FILES ${OBS_FILES}
DESTINATION obs
COMPONENT obs)

set(CPACK_PACKAGE_DESCRIPTION "${APPNAME} VM for ${FULL_PLATFORM_NAME}")
set(CPACK_PACKAGE_VENDOR "${APPNAME}")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://pharo.org")

Expand Down
15 changes: 13 additions & 2 deletions cmake/versionExtraction.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,18 @@ if (GIT_FOUND AND VERSION_UPDATE_FROM_GIT)
unset(${PROJECT_NAME}_PARTIAL_VERSION_LIST)

# Set full project version string

if("${${PROJECT_NAME}_VERSION_AHEAD}" STREQUAL "0")
set(${PROJECT_NAME}_AHEAD_STRING "")
else()
set(${PROJECT_NAME}_AHEAD_STRING "+${${PROJECT_NAME}_VERSION_AHEAD}")
endif()


set(${PROJECT_NAME}_VERSION_STRING_FULL
${${PROJECT_NAME}_VERSION_STRING}+${${PROJECT_NAME}_VERSION_AHEAD}.${${PROJECT_NAME}_VERSION_GIT_SHA})
${${PROJECT_NAME}_VERSION_STRING}${${PROJECT_NAME}_AHEAD_STRING}.${${PROJECT_NAME}_VERSION_GIT_SHA})



# Save version to file (which will be used when Git is not available
# or VERSION_UPDATE_FROM_GIT is disabled)
Expand All @@ -105,6 +115,7 @@ if (GIT_FOUND AND VERSION_UPDATE_FROM_GIT)
else()

# Git not available, get version from file
file(COPY ${CMAKE_SOURCE_DIR}/version.info DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(STRINGS ${CMAKE_SOURCE_DIR}/version.info ${PROJECT_NAME}_VERSION_LIST)
string(REPLACE "*" ";" ${PROJECT_NAME}_VERSION_LIST ${${PROJECT_NAME}_VERSION_LIST})
# Set partial versions
Expand All @@ -123,7 +134,7 @@ endif()

# Set project version (without the preceding 'v')
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
set(${PROJECT_NAME}_VERSION_FULL ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
set(${PROJECT_NAME}_VERSION_FULL ${${PROJECT_NAME}_VERSION}${${PROJECT_NAME}_AHEAD_STRING}.${${PROJECT_NAME}_VERSION_GIT_SHA})
if (${PROJECT_NAME}_VERSION_TWEAK)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION}-${${PROJECT_NAME}_VERSION_TWEAK})
endif()
41 changes: 41 additions & 0 deletions packaging/obs/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pkgname=(pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@)
arch=('x86_64' 'aarch64' 'armv7h')
pkgver=@PharoVM_VERSION_FULL@
pkgrel=0
pkgdesc="Pharo is a pure object-oriented programming language and a powerful environment, focused on simplicity and immediate feedback (think IDE and OS rolled into one)."
url="https://github.com/pharo-project/pharo-vm"
license=('MIT')
makedepends=(gcc clang cmake openssl-1.1 libutil-linux util-linux-libs libffi)
provides=(pharo)
source=("PharoVM-v${pkgver}.tar.gz")
md5sums=("SKIP")
libdir="/usr/lib"
destdir="${libdir}/${pkgname}"

build() {
cd pharo-vm
cmake . \
-DGENERATE_SOURCES=FALSE \
-DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=FALSE \
-DPHARO_LIBRARY_PATH=${pkgdir}${destdir} \
-DPHARO_BIN_LOCATION=${destdir}/lib \
-DBUILD_BUNDLE=FALSE
make install
}

package() {
depends=('openssl>1.0' 'libutil-linux' 'util-linux-libs' 'libffi>=3.3')

mkdir -p ${pkgdir}${destdir}/bin
mkdir -p ${pkgdir}${destdir}/lib
mkdir -p ${pkgdir}${destdir}

install -D -m755 pharo-vm/build/dist/pharo ${pkgdir}${destdir}
install -D -m755 pharo-vm/build/dist/bin/* ${pkgdir}${destdir}/bin
install -D -m755 pharo-vm/build/dist/lib/* ${pkgdir}${destdir}/lib

mkdir -p ${pkgdir}/usr/bin

ln -s ${destdir}/pharo ${pkgdir}/usr/bin/pharo
}

3 changes: 3 additions & 0 deletions packaging/obs/debian.changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@ (@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@.@PharoVM_VERSION_PATCH@) stable; urgency=low

@CHANGELOG_STRING@
1 change: 1 addition & 0 deletions packaging/obs/debian.compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
15 changes: 15 additions & 0 deletions packaging/obs/debian.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Maintainer: Esteban Lorenzano <[email protected]>, Pablo Tesone <[email protected]>, Guille Polito <[email protected]>
Section: devel
Priority: optional
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: https://github.com/pharo-project/pharo-vm

Build-Depends: debhelper (>= 8.0.0), cmake, clang, libssl-dev, uuid-dev, libffi7-dev (==3.3-4)

Package: pharo-vm-@PharoVM_VERSION_MAJOR@
Architecture: amd64 arm64 armhf
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: libcairo2, libsdl2-2.0-0, libgit2 (=1.0.1-1) | libgit2-1.1 | libgit2-1.5, libfreetype6
Description: Pharo is a pure object-oriented programming language and a powerful environment, focused on simplicity and immediate feedback (think IDE and OS rolled into one).
33 changes: 33 additions & 0 deletions packaging/obs/debian.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /usr/bin/make -f

export DH_VERBOSE=1
version=@PharoVM_VERSION_FULL@
libdir=/usr/lib/$(DEB_TARGET_MULTIARCH)
pkgdir=${libdir}/pharo${version}
buildPrefix=debian/pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@

%:
dh $@

override_dh_auto_configure:
set
dh_auto_configure -- \
-DGENERATE_SOURCES=FALSE \
-DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=FALSE \
-DPHARO_LIBRARY_PATH=${pkgdir}/lib \
-DPHARO_BIN_LOCATION=${pkgdir}/lib \
-DGENERATED_SOURCE_DIR="${PWD}/" \
-DBUILD_BUNDLE=FALSE

override_dh_auto_build:
cd obj-$(DEB_TARGET_MULTIARCH) && make install

override_dh_auto_install:
mkdir -p ${buildPrefix}${pkgdir}/bin
mkdir -p ${buildPrefix}${pkgdir}/lib

install -Dm755 obj-$(DEB_TARGET_MULTIARCH)/build/dist/pharo ${buildPrefix}${pkgdir}
install -D obj-$(DEB_TARGET_MULTIARCH)/build/dist/bin/* ${buildPrefix}${pkgdir}/bin
install -D obj-$(DEB_TARGET_MULTIARCH)/build/dist/lib/* ${buildPrefix}${pkgdir}/lib
mkdir -p ${buildPrefix}/usr/bin
ln -s ${pkgdir}/pharo ${buildPrefix}/usr/bin/pharo
10 changes: 10 additions & 0 deletions packaging/obs/pharo-Debian_Testing.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: 1.0
Source: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Version: @PharoVM_VERSION_FULL@
Binary: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Maintainer: Esteban Lorenzano <[email protected]>, Pablo Tesone <[email protected]>, Guille Polito <[email protected]>
Architecture: amd64
Homepage: https://github.com/pharo-project/pharo-vm
Standards-Version: 3.9.4
Build-Depends: debhelper (>= 8.0.0), cmake, clang, libssl-dev, uuid-dev, libffi7-dev (==3.3-4)
Depends: libuuid1, libssl, libffi7 (==3.3-4)
10 changes: 10 additions & 0 deletions packaging/obs/pharo-vm-10.3.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: 1.0
Source: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Version: @PharoVM_VERSION_FULL@
Binary: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Maintainer: Esteban Lorenzano <[email protected]>, Pablo Tesone <[email protected]>
Architecture: amd64 aarch64 armv7l
Homepage: https://github.com/pharo-project/pharo-vm
Standards-Version: 3.9.4
Build-Depends: debhelper (>= 8.0.0), cmake, clang, libssl-dev, uuid-dev, libffi7-dev (==3.3-4) | libffi-dev
Depends: libuuid1, libssl, libffi7 (==3.3-4) | libffi8
10 changes: 10 additions & 0 deletions packaging/obs/pharo-xUbuntu_22.04.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: 1.0
Source: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Version: @PharoVM_VERSION_FULL@
Binary: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Maintainer: Esteban Lorenzano <[email protected]>, Pablo Tesone <[email protected]>, Guille Polito <[email protected]>
Architecture: amd64
Homepage: https://github.com/pharo-project/pharo-vm
Standards-Version: 3.9.4
Build-Depends: debhelper (>= 8.0.0), cmake, clang, libssl-dev, uuid-dev, libffi7-dev (==3.3-4)
Depends: libuuid1, libssl, libffi7 (==3.3-4)
10 changes: 10 additions & 0 deletions packaging/obs/pharo-xUbuntu_23.04.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: 1.0
Source: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Version: @PharoVM_VERSION_FULL@
Binary: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Maintainer: Esteban Lorenzano <[email protected]>, Pablo Tesone <[email protected]>, Guille Polito <[email protected]>
Architecture: amd64
Homepage: https://github.com/pharo-project/pharo-vm
Standards-Version: 3.9.4
Build-Depends: debhelper (>= 8.0.0), cmake, clang, libssl-dev, uuid-dev, libffi7-dev (==3.3-4)
Depends: libuuid1, libssl, libffi7 (==3.3-4)
2 changes: 2 additions & 0 deletions packaging/obs/pharo.rpmlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addFilter("E: binary-or-shlib-defines-rpath")
addFilter("E: explicit-lib-dependency")
99 changes: 99 additions & 0 deletions packaging/obs/pharo.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Name: pharo-vm-@PharoVM_VERSION_MAJOR@.@PharoVM_VERSION_MINOR@
Version: @PharoVM_VERSION_FULL@
Release: 0
License: MIT
Summary: Pharo is a pure object-oriented programming language and a powerful environment
Url: https://github.com/pharo-project/pharo-vm
Group: Development/Languages/Pharo
Source: https://github.com/pharo-project/pharo-vm/release/%{name}-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake wget
%if 0%{?suse_version} || 0%{?sle_version} >= 150100
BuildRequires: clang
BuildRequires: libopenssl-1_0_0-devel libuuid-devel libffi7-devel
BuildRequires: -post-build-checks
Requires: glibc libopenssl1_0_0 libuuid1 libffi7
%endif
%if 0%{?fedora}
BuildRequires: clang
%if 0%{?fedora} >= 36
BuildRequires: openssl-devel libuuid-devel libffi-devel
Requires: glibc openssl libuuid libffi
%else
BuildRequires: openssl-devel libuuid-devel libffi7-devel
Requires: glibc openssl libuuid libffi7
%endif
%endif

BuildRoot: %{_tmppath}/%{name}-%{version}-build

%define destdir %{_libdir}/%{name}-%{version}

%description
Pharo is a pure object-oriented programming language and a powerful environment,
focused on simplicity and immediate feedback (think IDE and OS rolled into one).

%prep
%setup -q -n pharo-vm

%build
cmake . \
-DGENERATE_SOURCES=FALSE \
-DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=FALSE \
-DPHARO_LIBRARY_PATH=%{destdir}/lib \
-DPHARO_BIN_LOCATION=%{destdir}/lib \
-DBUILD_BUNDLE=FALSE
make install

%install
# Workaround for fedora >= 35
%if 0%{?fedora} >= 35
export QA_RPATHS=\$[0x0007]
%endif
mkdir -p %{buildroot}%{destdir}/bin
mkdir -p %{buildroot}%{destdir}/lib
install -Dm755 build/dist/pharo %{buildroot}%{destdir}
install -D build/dist/bin/* %{buildroot}%{destdir}/bin
install -D build/dist/lib/* %{buildroot}%{destdir}/lib
mkdir -p %{buildroot}/%{_bindir}
ln -s %{destdir}/pharo %{buildroot}/%{_bindir}/pharo
# Workaround to bypass test phase on OSL versions (rpath is no valid there, but
# we do not care as it will be ignored)
#%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150100
export NO_BRP_CHECK_RPATH=true
#%endif

%files
%defattr(-,root,root,-)
#%doc README.md
%{_bindir}/pharo
%{destdir}
%{destdir}/bin
%{destdir}/lib
%{destdir}/pharo
%{destdir}/bin/pharo
%{destdir}/lib/libB2DPlugin.so
%{destdir}/lib/libBitBltPlugin.so
%{destdir}/lib/libDSAPrims.so
%{destdir}/lib/libFileAttributesPlugin.so
%{destdir}/lib/libFilePlugin.so
#destdir/lib/libIA32ABI.so
%{destdir}/lib/libJPEGReadWriter2Plugin.so
%{destdir}/lib/libJPEGReaderPlugin.so
%{destdir}/lib/libLargeIntegers.so
%{destdir}/lib/libLocalePlugin.so
%{destdir}/lib/libMiscPrimitivePlugin.so
%{destdir}/lib/libPharoVMCore.so
#destdir/lib/libSecurityPlugin.so
%{destdir}/lib/libSocketPlugin.so
#destdir/lib/libSqueakFFIPrims.so
%{destdir}/lib/libSqueakSSL.so
%{destdir}/lib/libSurfacePlugin.so
%{destdir}/lib/libFloatArrayPlugin.so
%{destdir}/lib/libUUIDPlugin.so
%{destdir}/lib/libUnixOSProcessPlugin.so
%{destdir}/lib/pharo

%changelog

24 changes: 24 additions & 0 deletions scripts/prepare_obs_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Bash3 Boilerplate. Copyright (c) 2014, kvz.io

set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace

# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")" && pwd)" # <-- change this as it depends on your app

__TARGET="${1:-}"
__VERSION="${2:-}"

echo ${__VERSION}

mkdir -p ${__TARGET}
cp ${__root}/CHANGELOG.md ${__TARGET}/debian.changelog
for f in ${__root}/obs/*
do
__file="${__TARGET}/$(basename "${f}")"
cat ${f} | VERSION=${__VERSION} envsubst > ${__file}
done